Question

I have a TabActivity with 4 Tabs (Activities) in it. Now I want to pass data between these 4 Tabs. I know how to pass it to the parent (TabActivity), but how do I pass it to one of the running Tabs' Activities? With putExtra I can pass it some data, but how do I know in the other Activity that it got data (something like an Event/Callback/whatever)?

Was it helpful?

Solution

You check if the data is in the intent with getExtra. I would solve this with public static variables. The simply get the reference to the Object from onResume in your activity. Remember to check that it's null

OTHER TIPS

Each Activitys in Tab has its context. You can put extra/ get Extra as normal.

Another ways are:

Make public static variable. Preference.

Store it in SQLite.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top