Jona
Jona

Reputation: 13575

How to bring Activity to top of stack and reset it?

I'm trying to keep my activity calling flow simple for the user. Always one instance of the activity on the history stack.

So using flag FLAG_ACTIVITY_REORDER_TO_FRONT, is perfect! but there is a slight issue.

The activity is brought to the front and the onCreate() is not called if already started. Makes sense but I want the behavior to be that it calls onCreate().

Thanks for the help!

-Jona

Upvotes: 1

Views: 990

Answers (1)

Paul Imhoff
Paul Imhoff

Reputation: 36

Maybe what you are searching for is the method onNewIntent(). This method should be called if your Activity is already in the stack and is started again.

In here the new Intent should be passed to you, so that you can react and initialize you variables like you would do in onCreate() with the intent data fetched via getIntent().

Upvotes: 2

Related Questions