From 8b8c2ece7b711863e128331eb2c4cfd6ee52dc8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Oghin=C4=83?= Date: Mon, 19 Sep 2016 05:55:14 -0700 Subject: [PATCH] Document BaseActivityEventListener & new onActivityResult API Summary: Closes https://github.com/facebook/react-native/pull/9985 Differential Revision: D3886231 Pulled By: bestander fbshipit-source-id: b44869e7baf8a4e19b22578b2d033b5765276792 --- docs/NativeModulesAndroid.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/NativeModulesAndroid.md b/docs/NativeModulesAndroid.md index 54fefddf1..80f86c2df 100644 --- a/docs/NativeModulesAndroid.md +++ b/docs/NativeModulesAndroid.md @@ -318,17 +318,21 @@ componentWillMount: function() { ### 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, +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, ```java -reactContext.addActivityEventListener(this); +reactContext.addActivityEventListener(mActivityResultListener); ``` Now you can listen to `onActivityResult` by implementing the following method: ```java @Override -public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) { +public void onActivityResult( + final Activity activity, + final int requestCode, + final int resultCode, + final Intent intent) { // Your logic here } ```