SkillAgentSearch skills...

RxActivityResult

Reactive results from startActivityForResult() in the form of an Observable.

Install / Use

/learn @NateWickstrom/RxActivityResult
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

RxActivityResult

An Rx wrapper for receiving results from startActivityForResult() as an Observable.

Download

To launch from an Activity :

compile 'com.natewickstrom.rxactivityresult:rxactivityresult:0.1.0-rc3'

To launch from a Fragment :

compile 'com.natewickstrom.rxactivityresult:rxactivityresult-support-v4:0.1.0-rc3'

Usage

Example (with Lambdas for brevity):

static final int REQUEST_IMAGE_CAPTURE = 1;
 
RxActivityResult.getInstance(context).from(activity)
    .startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE), REQUEST_IMAGE_CAPTURE)
    .subscribe(result -> {
        if (result.getRequestCode() == REQUEST_IMAGE_CAPTURE && result.isOk() {
            Bundle extras = result.getData().getExtras();
            Bitmap imageBitmap = (Bitmap) extras.get("data");
            mImageView.setImageBitmap(imageBitmap);
        }
    });

For a slightly more in depth example see the Sample Project.

License

Copyright (C) 2016 Nathan Wickstrom

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
View on GitHub
GitHub Stars154
CategoryDevelopment
Updated6mo ago
Forks15

Languages

Java

Security Score

87/100

Audited on Sep 17, 2025

No findings