I implemented android native module from Bambora SDK and displayed its native view(activity) by getCurrentActivity().startActivity(intent);
It works like a charm but finish() makes whole app quit instead of going back. Here are some of my codes.
public class ToastModule extends ReactContextBaseJavaModule {
@ReactMethod
// Calling module function from ReactJS code and works well
public void goToRegisterCardView(Callback callback) {
Intent intent = new Intent(getCurrentActivity(), NativeCardRegistrationActivity.class);
getCurrentActivity().startActivity(intent); //start Activity successfully
}
...
}
public class NativeCardRegistrationActivity extends AppCompatActivity implements ICardRegistrationCallback {
@Override
public void onRegistrationSuccess(CreditCard creditCard) {
finish();// Exit whole app instead of going back.
}
...
}
So I'm sure it's not a reason from Bambora SDK and finish() kills NativeCardRegistrationActivity. The whole app is killed because there is no activity in Activity Stack.
Because I'm not familiar with Java code, I'm not able to figure out what the reason is here.
Please let me know what's wrong and how I can go back to original react-native activity.
**Update
Here is my MainApplication.java codes
public class MainApplication extends MultiDexApplication {
// Needed for `react-native link`
public List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
// new MainReactPackage(),
new AnExampleReactPackage(this)
);
}
}
Currently, I commented new MainReactPackage() for temporarily and it doesn't occur error, but if I remove the comment to enable new MainReactPackage() then, I can see error with red background.
Please check this. ReactNative: Android Native Module