views:

58

answers:

2

Hello all,

I have a auto-complete textbox in which the user makes a selection. From here I want to load a tabbed layout which is based on the user selection. The problem is I cant figure out a clean way to pass that selection to each of the tabs. At the moment I can pass an intent to the 'tabhost' activity and then pass to each child activity explicitly, however this just seems like messy iterative code to me! So basically how can I pass my intent data bundles to the tabs activities cleanly & efficiently! Psuedo code is also very welcome ;)

Cheers guys

A: 

You can store the selection as SharedPreference and then just obtain the value from any activity. Second option that comes in mind is saving the selected value on the Application context which is also easily accessible from any activity.

Konstantin Burov
A: 

Sounds like you need to broadcast some information. You than will be able to set broadcast receivers in any activity/service you would like to get notified.

Read more online about Broadcastreceiver and about send broadcast

Pentium10