Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to close activity without actually finishing?

Tags:

java

android

I want to:

open 1, 2, 3 activities
1 > 2 > 3  

back to #2
1 > 2

open #4 activity
1 > 2 > 4

back to #2
1 > 2

restore #3 activity
1 > 2 > 3

"Restore" means open previously closed activity without re-creating. How can i do that?

Thanks!

like image 218
user1312837 Avatar asked May 30 '12 12:05

user1312837


People also ask

How do you pause activity?

onPause() for current activity will be called before you go to myActivity, where onCreate() gets called. Now if you press back button, myActivity's onPause() gets called, and you move back to activity A, where onResume() is called.

How do I know if my activity is finished?

Using activity. isFinishing() is the right one solution. it return true if activity is finished so before creating dialog check for the condition.


1 Answers

open 1, 2, 3 activities
1 > 2 > 3  

back to #2
1 > 2          // call startActivity for 2, don't call finish() in 3

open #4 activity
1 > 2 > 4

back to #2
1 > 2

restore #3 activity
1 > 2 > 3      // call startActivity for 3 with intent as Intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_To_FRONT);
like image 64
Shrikant Ballal Avatar answered Sep 28 '22 06:09

Shrikant Ballal