There are many threads which explain this. When you are calling finish()
, Android will let your code in the specific block after the finish()
call execute, and that is why the Toast message appears. A simple return statement after the finish()
call is the solution. Taken from answer on question:
Other relevant ones are:
Calling finish() on an Android activity doesn't actually finish
Hope this helps.