Currently I am working with Android
and I still have some troubles with understanding the Activity
lifecycle.
Let me show you my problem with an example:
My App contains a Navigation Drawer
which allows to use to switch between different Fragment
s. One Fragment (Fragment A) is a list with some items. Clicking one item opens activity B which can be described as a detail view of the item. B receives all necessary information by an Intent, the item model implements Parcelable and it is put as an Extra to the Intent
. A button
of Activity B opens the map view Activity C.
A -(Item)-> B -> C
Using the Up button in the action bar of C crashes the app when the B Activity onCreate method calls
Item item = bundle.getParcelable("com.example.myapp.model.Item");
Of course, because the detail view B gets all necessary information which has to be displayed from A. How can I solve that problem? I want to be able to store the item somehow when calling C and going up to B again. (Using the back button on C works fine)