I need advice for the next implementation.
I have an app, which has different distinct sections. Each has a target, more or less differentiated.
One of them is a chat. This chat is an Activity, which has 3 fragments, like Whatsapp, but much simpler.
When I start the activity, I start a service that connects to the XMPP server, users get, messages, invitations, etc ....
When I start a chat with a user, start a new activity. (This is important)
When the XMPP Service receives things, I'm sending through sendbroadcast the fragments and update information. So far so good, as both the activity and its three fragments I have them in memory, and I can go update their respective objects.
My problem is the next: When I open a chat with a user, open a new activity, and lose access to the objects that are needed me. (For example the user list, now if my service receives a request of friendship, I can not add, because the object does not have)
What should I do?
As far as I know 3 options:
1- Pass through intent on the objects to start, obviously I have to do parceables. And when you close the chat activity, return the updated objects.
2- create me a singleton object (as I read, many problems with memory loss)
3- Later, I'll have to create a SQLite to save the message history. Could I use this database to be keeping these objects temporarily?
Better you have a choice? Different recommendation?