Difference between finish() and finishAndRemoveTask() in Android App code.

Опубликовано: 07 Май 2022
на канале: Programmer World
2,307
23

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();
}
}

-


На этой странице сайта вы можете посмотреть видео онлайн Difference between finish() and finishAndRemoveTask() in Android App code. длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Programmer World 07 Май 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 2,307 раз и оно понравилось 23 зрителям. Приятного просмотра!