In my PoC, I have some Activities, HomeActivity, CreateActivity, SearchActivity, ResultsActivity, ResultDetailsActivity, and UpdateActivity.
I have two main navigation paths: Create and Search.
Navigation for the Create path is as follows: HomeActivity–> CreateActivity -(on complete)-> HomeActivity
Navigation for Search is as follows: HomeActivity–> SearchActivity –> ResultsActivity(ListActivity) –> ResultDetailsActivity –> UpdateActivity -(on complete)-> ResultDetailsActivity (with updated data).
Currently, navigation to a new Activity is via startActivity(intent) method. However, this is causing multiple instances of each Activity to be opened.
I’m rather new to Android. Could someone please suggest how I could avoid this?
Setting either the following flags may help you to resolve your issue:
Intent.FLAG_ACTIVITY_CLEAR_TOPIntent.FLAG_ACTIVITY_REORDER_TO_FRONT