diff --git a/releases/next/docs/native-modules-android.html b/releases/next/docs/native-modules-android.html index 3d49c62876d..185bd370462 100644 --- a/releases/next/docs/native-modules-android.html +++ b/releases/next/docs/native-modules-android.html @@ -178,8 +178,12 @@ componentWillMount: // handle event. }); } -...

Getting activity result from startActivityForResult #

You'll need to listen to onActivityResult if you want to get results from an activity you started with startActivityForResult. To do this, the module must implement ActivityEventListener. Then, you need to register a listener in the module's constructor,

reactContext.addActivityEventListener(this);

Now you can listen to onActivityResult by implementing the following method:

@Override -public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) { +...

Getting activity result from startActivityForResult #

You'll need to listen to onActivityResult if you want to get results from an activity you started with startActivityForResult. To do this, the you must extend BaseActivityEventListener or implement ActivityEventListener. The former is preferred as it is more resilient to API changes. Then, you need to register the listener in the module's constructor,

reactContext.addActivityEventListener(mActivityResultListener);

Now you can listen to onActivityResult by implementing the following method:

@Override +public void onActivityResult( + final Activity activity, + final int requestCode, + final int resultCode, + final Intent intent) { // Your logic here }

We will implement a simple image picker to demonstrate this. The image picker will expose the method pickImage to JavaScript, which will return the path of the image when called.

public class ImagePickerModule extends ReactContextBaseJavaModule implements ActivityEventListener {