Issue
I have an Android application and I faced a weird problem. I have an activity and in the onStop() method I call finish() like so:
@Override
public void onStop() {
super.onStop();
finish();
}
The problem is that when I close the activity by pressing the round button in the navigation bar and then reopen the app from the recent apps tab in the navgiation bar then the activity is just recreated. That means the onCreate() method is called. What I would like instead is that the MainActivity is opened.
What am I doing wrong?
Solution
You should be able to accomplish what you want by adding
android:noHistory="true"
to the <activity>
declaration in your manifest.
In that case you don't need to add the all to finish()
in onStop()
.
I'm assuming your app has only one Activity
.
Answered By - David Wasser
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.