Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android- noHistory = true not working when come back from recents

I'm following the next flow, Start activity A (loading resources), then go to Activity B (login). I marked Activity A as noHistory = "true" and just after I start the activity B I call finish() on activity A.

The app works as expected and when I pressed the back button from the Activity B the app closes, when I pressed the recents button and select my app, it restarts from activity A, I want it to starts from activity B.

thanks.

like image 622
Juan Pablo Alvarez Ovalle Avatar asked May 01 '16 03:05

Juan Pablo Alvarez Ovalle


2 Answers

Add this to your activity declaration in the AndroidManifest:

        android:excludeFromRecents="true"

And it will be excluded from the "recent apps" list

like image 97
Amir Uval Avatar answered Sep 22 '22 08:09

Amir Uval


that is expected behaviour . Since you have pressed the back button the app is closed , if you launch from recent after that its like clicking on app icon to launch the app . You can use shared preferences to save if the first activity is already launched you can directly launch second activity

like image 26
Praveen Pandey Avatar answered Sep 25 '22 08:09

Praveen Pandey