Calling finish() on an Android activity doesn't actually finish

Solution 1:

You should put a return statement after that finish, because the method that called finish will be executed completely otherwise.

also, see this question: about finish() in android

Solution 2:

finish() just tells the activity to do what it needs to do to finish, eg. shutdown, call on onPause, report result to parent, etc. It doesn't do an exit() call or anything.

You should return after the finish() call.

Solution 3:

Adding to the other answers, you still may have (Re)onStart, onResume and onPause invoked.

I say this because in the following link, there is a table that says that for one activity to be killed, first it is invoked onPause (and probably but not guaranteed) on Stop and onDestroy.

Reference Activity

Solution 4:

put in manifest :

    <activity android:name=".MainActivity"
        android:noHistory="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

to avoid holding it in history stack of the system