Rakesh Gondaliya Rakesh Gondaliya - 2 months ago 30x
Android Question

Android : Finish Activity from other Activity

I am having application in which i am using menu , on tap on menu item i am redirecting to specified activity.

I want to make sure that when i am redirected to another menu item my current all activity should be finished to reduce the stackflow of the activity and better performance.

So when i tap on back from my tapped activity from the selected menu activity i should be redirected to another activity and finish current activity.

So i am wondering is there any way by which i can finish another activity from my current activity. Or should i override the OnKeyDown Method..

Any help on this

Thanks in advance


You can do:

Intent intent = new Intent(....) ; // intent to launch the new activity
// fire intent
finish(); // finish current activity