Activity Navigation advice please
Ok . . . I have read hours upon hours of advice and forums and developer pages to no conclusive answer.
what I have: is an app with 8 activities and each has a slightly different set of buttons to navigate to some of the other activities. Each activity has multiple forms of data collection, ultimately ending in an e-mail intent which collects all application UI data.
Problem: I cant seem to find the proper way to use the navigation buttons in conjuction with onSavedInstanceState so that no matter what, everytime an acti开发者_运维百科vity is started it will appear with any and all data the user has inputed(sp?) thus far, during this instance of the application. I dont want to save data beyond closing the app. I do want the user to be able to navigate back and forth as much as necessary within the activities without losing data until the app closes.
This is what I have:
Activity A: has buttons to: Activity B, C, D, E, and F(F=email intent)
Activity B: has buttons to: Activity G, and A Activity G: has buttons to: Activity B, and A
Activity C: has buttons to: Activity H, I, and A Activity H: has buttons to: Activity C, I, and A Activity I: has buttons to: Activity H, I, and A
Activity D: has button to: Activity A
Activity E: has button to: Activity A
Is there a better way to set up my navigation? (this is optimal for the context I am fairly sure)
And what is the proper launch mode/Flags/savedinstancestate and whatever to achieve proper result? I can explain elaborate as much as needed.
I am aware I need to save the data the problem is setting up the activities so that the navigation buttons i have put in each activity always open activity showing all previously saved data (in the current task instance)
I have all activites set to launchMode:singleTask, I have not manually coded any flagsand I have set up onsavedinstance properly but something as simple as: Activity B-> Activity A-> Activity B (using only my buttons) Activity B saves nothing after going to A and back again (again I am not using back key, I am using my navigation buttons in the layout) How can I fix this??
Oddly tho Activity A DOES retain memory but none of the other activities do
Why you're using singleTask?
Aren't you looking for
intent.setFlag(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
?
精彩评论