开发者

Android Tabs & Intents

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


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜