Question

I have 3 fragment activities: home screen, a news feed, and an article view. Clicking the button on the home screen opens the news feed, clicking an article in the news feed opens the article view. But when I click the "Back" button in the article view, it returns to the home screen.

Is there any reason it would be skipping the previous activity? How do I make sure it goes back to the calling activity rather than the home screen?

Was it helpful?

Solution

I fixed the problem by adding android:alwaysRetainTaskState="true" to the activities that opened the article.

I think the issue was that the activity was getting destroyed when I switched to the article activity and when it tried to go back there was nothing there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top