Created
November 29, 2017 12:23
-
-
Save kaueDM/3b59971310be9912f35f00def7bfcbf9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* TestTestTest | |
**/ | |
public class TestTestTest extends Activity { | |
public String getMyText() { | |
return myText; | |
} | |
public void setMyText(String myText) { | |
this.myText = myText; | |
} | |
String myText = "Initial Value"; | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setMyText("Hello World!"); | |
} | |
public String showText () { | |
Log.d("test___", "My Text: " + getMyText()); | |
return getMyText(); | |
} | |
} | |
/** | |
* TestModule | |
**/ | |
public class TestModule extends ReactContextBaseJavaModule { | |
TestTestTest test; | |
//Constructor | |
public TestModule(ReactApplicationContext reactContext) { | |
super(reactContext); | |
} | |
//Module Name | |
@Override | |
public String getName() { return "TestModule"; } | |
@ReactMethod | |
public void getMyText (Promise promise) { | |
test = new TestTestTest(); | |
test.showText(); //retorna `Initial Value` | |
promise.resolve("Olha o console do Android Studio"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment