tags:

views:

98

answers:

2

Hi,

I have a TabActivity, and the tabs point to sub activities. Is there a way I can send a 'message' to those child activities? I just want to pass a string across, not sure if this is possible.

I have some data being fetched by the parent TabActivity, and the child tabs can't do anything useful until the parent is done fetching. When fetching is complete, I'd like to pass that data to the child activities so they can do something useful with it.

Notmally I'd set the data to be passed in the Intent when first creating the activity, but in this case I can't do that.

Thanks

A: 

I would say you have 2 options, either put for instance static view before your tabactivity and display a progress bar while doing your fetching and then display your tabs with the full content, or fetch your content, store it in a variable and reload the whole activity by doing an intent on itself.

These are the easiest way I would do it... does it make sense?

Sephy
+3  A: 

I have a TabActivity, and the tabs point to sub activities.

Don't do that. All you are doing is making your life harder and making your application take more memory, CPU time, and battery life.

Use Views as the contents of the tabs, instead of activities, and you will not have communication difficulties of this nature.

Here is a sample project using Views as the contents of tabs.

CommonsWare