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();
}
}
-
Nesta página do site você pode assistir ao vídeo on-line Difference between finish() and finishAndRemoveTask() in Android App code. duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Programmer World 07 Maio 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 2,307 vezes e gostou 23 espectadores. Boa visualização!