0

I want each activity in my android app to contain a self made navigation view that looks like this

ActivityStartedFirst > 2ndActivity > YouAreHereActivity

Where ActivityStartedFirst and 2ndActivity is clickable and takes me back to those activites.

So if I go to e.g. ActivityStartedFirst then 2ndActivity and YouAreHereActivity will still be shown so the user can revert his choise and move up again.

Everything is trivial except: how do I best go about passing the intent list from activity to activity without loosing it when android destroys my activity after onPause? Any ideas? Do I just use a static variable in my base activity and just save the intents as pacelables in onPause and if the static variable is null when onCreate is called (that means android killed my app) then the intents are restored from the parcelables? Whould something like that be sensible?

cdbeelala89
  • 2,066
  • 3
  • 28
  • 39
  • use shared preferences or database – Raghunandan May 07 '13 at 15:45
  • You could also subclass Application and have a static Intent[] variable there or something. – Cornholio May 07 '13 at 15:49
  • After reading the answer from (http://stackoverflow.com/questions/13674421/how-to-get-a-list-of-the-activity-history-stack), consider use this implementation (http://stackoverflow.com/questions/10606408/automatically-log-android-lifecycle-events-using-activitylifecyclecallbacks) so you can create your path. – AlexBcn May 07 '13 at 15:58
  • Just keep on passing the string arrays with the current Activity name appended in putExtra while calling a new Activity and display the Activity's name in the navigation bar using that string array..and on click of each Navigation bar item just call the intent with passing the selected class's name using **Intent intent = new Intent (this, Class.forName(activiyClassName))** – bakriOnFire May 07 '13 at 16:38

0 Answers0