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();
}
}
-
Auf dieser Seite können Sie das Online-Video Difference between finish() and finishAndRemoveTask() in Android App code. mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Programmer World 07 Mai 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 2,307 Mal angesehen und es wurde von 23 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!