title: React Native: Android activity go back
body: <p>I implemented android native module from <a href="https://developer.bambora.com/europe/native-payment/android/registering-cards" rel="noreferrer">Bambora SDK</a> and displayed its native view(activity) by <code>getCurrentActivity().startActivity(intent);</code></p>
  
  <p>It works like a charm but <code>finish()</code> makes whole app quit instead of going back. Here are some of my codes.</p>
  
  <pre><code>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.
      }
      ...
  }
  </code></pre>
  
  <p>So I'm sure it's not a reason from <strong>Bambora SDK</strong> and <code>finish()</code> kills <code>NativeCardRegistrationActivity</code>. The whole app is killed because there is no activity in <code>Activity Stack</code>.
  Because I'm not familiar with Java code, I'm not able to figure out what the reason is here.</p>
  
  <p>Please let me know what's wrong and how I can go back to original react-native activity.</p>
  
  <p>**Update</p>
  
  <p>Here is my MainApplication.java codes</p>
  
  <pre><code>public class MainApplication extends MultiDexApplication {
  
    // Needed for `react-native link`
    public List&lt;ReactPackage&gt; getPackages() {
      return Arrays.&lt;ReactPackage&gt;asList(
  //      new MainReactPackage(),
        new AnExampleReactPackage(this)
      );
    }
  }
  </code></pre>
  
  <p>Currently, I commented <code>new MainReactPackage()</code> for temporarily and it doesn't occur error, but if I remove the comment to enable <code>new MainReactPackage()</code> then, I can see error with red background.</p>
  
  <p>Please check this.
  <a href="https://stackoverflow.com/questions/45275243/react-native-android-native-module">ReactNative: Android Native Module</a></p>