React Native: Android Activity Returns

I implemented my own Android module from the Bambora SDK and mapped its own view (activity) to getCurrentActivity().startActivity(intent);

It works like a charm, but finish() makes the whole application terminated rather than returning. 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. } ... } 

Therefore, I am sure that this is not a reason from the Bambora SDK and finish() kills NativeCardRegistrationActivity . The entire application is killed because there is no activity in the Activity Stack . Since I am not familiar with Java code, I cannot understand what the reason is.

Please let me know what happened and how I can return to the initial active reaction.

** Update

Here are 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 have temporarily commented on new MainReactPackage() and no error occurs, but if I remove the comment to enable new MainReactPackage() , then I can see the error with a red background.

Please check it. ReactNative: Android core module

+4
source share

Source: https://habr.com/ru/post/1270142/


All Articles