Skip to content

Instantly share code, notes, and snippets.

@kaueDM
Created November 29, 2017 12:23
Show Gist options
  • Save kaueDM/3b59971310be9912f35f00def7bfcbf9 to your computer and use it in GitHub Desktop.
Save kaueDM/3b59971310be9912f35f00def7bfcbf9 to your computer and use it in GitHub Desktop.
/**
* 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