how to close activity without actually finishing?

android, java

Solution

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

Problem

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!

Original source