I have a database tree structure in the backend of my application. It basically looks like the following:
List
|- View
I wrote the functionality to transform a View to a List displaying the View. Shown in here:
List
|- List
|- View
When triggering the toList()
function the Application should rebuild the structure in the database, and switch to the new List Activity displaying the list content.
All of the above works, except one thing:
When switching to the new List Activity the previous View should be removed from the stack in order to keep the order when pressing the 'back' button.
I tried with the following intent:
Intent i = new Intent(ViewActivity.this, ListActivity.class);
// new_item is a DTO containing the needed id to create the List activity
i.putExtra("selected_item", _new_item);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PostActivity.this.startActivity(i);
as well as:
Intent i = new Intent(ViewActivity.this, ListActivity.class);
// new_item is a DTO containing the needed id to create the List activity
i.putExtra("selected_item", _new_item);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
PostActivity.this.startActivity(i);
which both didn't work as expected.
Is there any other method of maybe using finish()
with the above intent?
I explicitely don't want to start the activity for a result.