title: Managing android activity stacks: How can a specific instance of an activity bring itself to the front?
body: <p>I have a set of activities that I am navigating between, and because these activities are expensive to initialize, I would like to preserve the existing state if possible. The problem is that I might have the same activity open more than once, with a different state in each, and I didn't see a way that the standard Android flags could help me out with that situation.</p>
  
  <p>Here's a visual example:</p>
  
  <p>Imagine I have three activities:</p>
  
  <p>A, B, C</p>
  
  <p>Each of these activities can be open more than once, each one holding a different state. Not only are these activities expensive to initialize, but I'd also like to maintain the user's current state such as scroll position, selected items, etc...</p>
  
  <p>Let's say that A(1) is an instance of activity A in state 1, and A(2) is an instance of activity A in state 2. A(1) and B(1) are unrelated.</p>
  
  <p>I want to implement a circular navigation stack as follows:</p>
  
  <p>... --> A(1) --> A(2) --> B(1) --> B(2) --> B(3) --> A(3) --> C(1) --> A(1) --> ...</p>
  
  <p>Since the activities are expensive, I'd really like to just reuse the existing instances. However, I might need to keep around 2 or 3 instances of the same activity as you can see above.</p>
  
  <p>Thanks!</p>