Android – how to kill specific activities?
When my Android application starts, it will start the main activity. It displays a full screen image for 5 seconds, and then uses intent to jump to another activity. What I want is to kill the main activity, so that when the user presses the back button on the navigation bar instead of opening the main activity, the application will be closed
One more thing: – I don't want to continue destroying the previous activity. I just want to kill that activity (i.e. the main activity) after sending the intention to the new activity, because I will add more activities
We can say that my real purpose is to destroy the main activity and treat the next activity (among all other activities) as an activity through which I can leave the application using the back button on the navigation bar
I can't explain my problem correctly in words, but please try to find out what my problem is, what I mentioned
resolvent:
In MainAcitivity, second activities are invoked as follows:
Intent intent=new Intent(this,<your second activity.class>;
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();