In this video it shows the difference between the two APIs in Android - finish() vs finishAndRemoveTask().
finish() is basically to minimize the App's view so that the user cannot see the App's layout anymore. It is similar to pressing back button from App's home page to go back to Android OS screen.
finishAndRemoveTask() is similar to finish(). However, in addition to the functionality of finish() it also removes the App's task from the Android OS task manager. Hence, the App is no more accessible and cannot be resumed from the task manager. The only option for the user is to restart the App using the App's icon click.
I hope you like this video. For any questions, suggestions or appreciation please contact us at: https://programmerworld.co/contact/ or email at: programmerworld1990@gmail.com
Complete source code and other details/ steps of this video are posted in the below link:
https://programmerworld.co/android/di...
However, the main Java code is copied below also for reference:
package com.programmerworld.finishandremovetaskapp;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void buttonFinish(View view){
finish();
}
public void buttonFinishAndRemoveTask(View view){
finishAndRemoveTask();
}
}
-
On this page of the site you can watch the video online Difference between finish() and finishAndRemoveTask() in Android App code. with a duration of hours minute second in good quality, which was uploaded by the user Programmer World 07 May 2022, share the link with friends and acquaintances, this video has already been watched 2,307 times on youtube and it was liked by 23 viewers. Enjoy your viewing!