Assuming I have three activities with Android Studio:
Act_A
Act_B
Act_C
The Act_A calls Act_B, and Act_B calls Act_C:
Intent intent = new Intent(Act_A.class,Act_B.class);
startActivity(intent);
...
Intent intent = new Intent(Act_B.class,Act_C.class);
startActivity(intent);
In Act_C a process is executed in which it should automatically be returned to Act_B, for which something similar is done:
Intent intent = new Intent(Act_C.class,Act_B.class);
startActivity(intent);
At this point, if the user presses the return button, it should be returned to Act_A, but it happens to be returned to Act_C, if you press once again the return button returns to Act_B.
My questions are:
Is there a way to "delete" the previous state so that it doesn't return to the previous activity or is there a way to modify it to return to the activity that I want?
The problem is that I have to return a value from Act_C to Act_B and I can not use finish(), something similar to the following:
In Act_C:
Intent intent = Act_B.newIntent(getActivity(),5);// return 5
startActivity(intent);
Thanks