Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Relationship between android:noHistory and android:finishOnTaskLaunch

How do these two attributes relate? If I have android:noHistory="true", does having android:finishOnTaskLaunch="true" have any significance/meaning?

like image 629
kolistivra Avatar asked Mar 10 '14 19:03

kolistivra


2 Answers

Let's say you have three activities in your app: A, B, and C. You start your app and see A, click a button and see B, click a button and see C.

First scenario

Now if you press the Back button on your phone, you will see B.

Second scenario

Let's say that B has android:noHistory="true". Now if you press the Back button on your phone, you will see A. The android:noHistory="true" attribute removed B from the history (i.e. the activity stack), so you will not see it when you hit the Back button.

Third scenario

Let's say that C has android:finishOnTaskLaunch="true". Now if you press the Home button on your phone and then launch the app again, you will see B. Android ended C when you launched the app again because it has the android:finishOnTaskLaunch="true" attribute.

like image 105
Racil Hilan Avatar answered Oct 15 '22 16:10

Racil Hilan


finishOnTaskLaunch would kill the Activity as you move to another task. But noHistory would kill the Activity if you move to another activity in the same task.

like image 32
Amar Avatar answered Oct 15 '22 16:10

Amar