Alan Chambers
Lurker
What is the best way to share complex data between activities? Suppose Activity A reads data from a database into a data structure, and presents some graphs or whatever based on that data structure. Then the user launches Activity B, which modifies the data in the database. When they return to Activity A, I want the UI to update correctly to reflect any changes made.
I'm new to Android, but not to programming, but the independence of the activities has thrown me a bit. I think what I'd really like is for the data structure created in A to be available in B, and for A to simply refresh the UI in onRestart() or similar. What is the correct Android idiom for achieving this? A singleton seems appealing, but I understand there might be issues related to singletons if the process is killed when the system needs resources.
I'm new to Android, but not to programming, but the independence of the activities has thrown me a bit. I think what I'd really like is for the data structure created in A to be available in B, and for A to simply refresh the UI in onRestart() or similar. What is the correct Android idiom for achieving this? A singleton seems appealing, but I understand there might be issues related to singletons if the process is killed when the system needs resources.