Search code examples
androidcontrol-flow

How to resume an activity?


I have 3 activites a, b and c. This is how they work:

a->b->c

a starts b, b starts c. What I want to do is, I want to resume c from a, if c is running. I don't want to restart c. I cannot just pass an intent, as c needs some extra data in the intent to start again. So is there a way to resume c from a?


Solution

  • Resuming c from a means there should be something like: a=>b=>c=>...=>a in this case: try:

    Intent i = new Intent(a, c.class);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(i);
    

    this will destroy every class after c=>.... and will return to c.