Fix some typos in NativeModulesAndroid.md

Summary:
Hi, here are some typo fixes in the documentation related to Android native modules:
* Add missing package and imports for the second part of the basic tutorial (register module)
* Add missing `public` keyword
* Remove incongruous word
Closes https://github.com/facebook/react-native/pull/11938

Differential Revision: D4439220

Pulled By: hramos

fbshipit-source-id: e7086fe384ed6238306abf0ee72c944fac53ad7b
This commit is contained in:
Louis Lagrange 2017-01-19 17:04:53 -08:00 committed by Facebook Github Bot
parent 10a29aa954
commit fa21822241
1 changed files with 14 additions and 2 deletions

View File

@ -98,7 +98,19 @@ Read more about [ReadableMap](https://github.com/facebook/react-native/blob/mast
The last step within Java is to register the Module; this happens in the `createNativeModules` of your apps package. If a module is not registered it will not be available from JavaScript.
```java
class AnExampleReactPackage implements ReactPackage {
package com.facebook.react.modules.toast;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class AnExampleReactPackage implements ReactPackage {
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
@ -326,7 +338,7 @@ 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 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,
You'll need to listen to `onActivityResult` if you want to get results from an activity you started with `startActivityForResult`. To do this, 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(mActivityResultListener);