I have a couple of actions that must live or die together. Basically, AlphaActivity does some work and then sends the intent ( startActivityForResult() ) to BetaActivity. When BetaActivity is complete, I want it to send an intention ( startActivity() ) for GammaActivity, and then I call finish() . At the end, I was hoping that the AlphaActivity onActivityResult() method would be called, but that didn't seem to happen. My design is such that inside AlphaActivity onActivityResult() I call finish() . My plan is that after reaching GammaActivity, the user can never return to either AlphaActivity or BetaActivity. But currently, the back button brings the user to AlphaActivity.
I have some ideas why this does not work, but discussing them here is pointless, as I am interested in what might actually work.
EDIT:
The code is all pretty standard stuff:
Inside Alpha
private void startBetaActivity() { Intent intent = new Intent(this, BetaActivity.class); startActivityForResult(intent, Constant.EXIT_CODE); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { if (requestCode == Constant.EXIT_CODE) { this.finish(); } } }
Inside Beta:
if (success) { startGammaActivity(); finish(); }
android android-intent android-activity activity-finish back
learner
source share