Devil's Dream
Devil's Dream

Reputation: 715

Going back to parent activity from any other child activity without reload

I have a MapView in the MainActivity. User can roam maps. There are many activities. I want to go back to MainActivity from any activity that can be third or fourth level activity. I am following this answer. It is a solution to go back from second activity to Parent with data. But when I am trying to go back to parent from 3rd or 4th activity finish() will not work as it will return previous activity. So I have started the parent activity with startActivity(mainIntent). The problem is its reloading the MapView from its start, the parent Intent is reloading. How can I pass data from third or fourth activity to parent without reloading the MapView?

Upvotes: 0

Views: 1025

Answers (1)

Devil's Dream
Devil's Dream

Reputation: 715

mainIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);

Worked!!!

Upvotes: 2

Related Questions