Issue
This is the structure of my application:
Activity A is a ListViewActivity
with a button to start B activity.
In the B activity after completing a form is there a button to start the C activity.
The C activity save the setting and create a new record to show in A activity. The Button save in C activity launch the A activity.
If the user follow this procedure more than once when he press the back button from the A activity return on the B(without passing through the C because when I started it I set FLAG_ACTIVITY_NO_HISTORY
) and the second time he press back return to A again, and this repeats number of time equal to the number of created records.
Close the app with back button became a long process.
I would like the onBackPressed
from the A activity always close the app.
English is not my language, I hope I was clear.
Solution
Always start your activity A like below
Intent intent = new Intent(current_activity_context, A.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
Answered By - Sonali8890
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.