I have little confusion between finish()
method and finishAndRemoveTask()
method. If any one have idea about it than please explain difference between them.
Difference between finish() and finishAndRemoveTask()
6.1k views Asked by Anand Savjani At
3
There are 3 answers
0
On
First you need to be familiar what is a "Task" and "Back Stack"
A task is a collection of activities that users interact with when performing a certain job. The activities are arranged in a stack (the back stack), in the order in which each activity is opened. For more details, you can refer to: http://developer.android.com/guide/components/tasks-and-back-stack.html
finish()
will close the active Activity
finishAndRemoveTask()
will close the active Activity and clear any pending tasks.
finish()
closes the current activity and optionally propagates the result of this activity to whoever launched it.finishAndRemoveTask()
closes the activity and removes the task as a part of finishing the root activity of the task. The task is also removed from recents.