Reputation: 193
When a user goes from activity A to B, then back to A using the back button, how do I reset the activity so it's in its original state?
Upvotes: 0
Views: 1624
Reputation: 6881
Have android:noHistory="true"
in your manifest file. A value of "true" means that the activity will not leave a historical trace. It will not remain in the activity stack for the task, so the user will not be able to return to it. Find about it here.
Soon after yo have a back buton pressed at B you can have
Intent intent = new Intent(this, A.class);
startActivity(intent);
finish();
Upvotes: 1
Reputation: 56925
Just finish your Activity A
when you call Activity B
and onBackPressed()
of Activity B call it again . So it will start new Activity A
.
Write below code in Activity B.
@Override
public void onBackPressed()
{
// Calling Activity A
// Finish Activity B
}
Upvotes: 1