Skip to content Skip to sidebar Skip to footer

Why Is Finish() Not Quitting Processing Immediately?

Is there any particular situation when it is handy to not quit the Activity immediately after calling finish() ? (in other way, why is this method not quitting the Activity immedia

Solution 1:

Shouldn't you do a return to prevent the codes below to execute:

if(somecondition){
    finish();
    return;
}

Solution 2:

Imagine you have a thread_0 with a loop handling all the events.

Calling finish adds a new event, but the activity isn't killed until thread_0 handles the event.

Solution 3:

Something to check: are you running any Async tasks that are not finished?

Solution 4:

finish() just hides the activity but not killed immediately. And makes it available for killing at later when os will need some memory to run other apps or processes.

Solution 5:

I guess Android allows you to save some data even after finish(). I think cancelling could also hurt the thread. In your case you could use return; to stop the code from executing.

Post a Comment for "Why Is Finish() Not Quitting Processing Immediately?"