I’ve two activities A and B.
There si a button BTN in A that does:
Intent myIntent = new Intent(A.this, B.class);
startActivityForResult(myIntent, B_VIEW);
- I click BTN
- Then I click back button that perform a finish() in B.
- Then I quick press the button BTN that opens again B.
The issue is that if the B.onDestroy(), caused by the previous finish() (step 2), has not yet executed, it executes now, so B closes 🙁
I want that, if not yet executed, the B.finish() will not fire if I reopen B. How?
You are better off re-working how you handle this kind of process to begin with.
Your best bet is to package the key data into a bundle in the
onSaveInstanceState, and then checking to see if that bundle exists in theonCreate(Bundle)function. Something like this would work (Largely copied from the Android Docs):