开发者

How to pass paramters from Activity A, to the tabs of a TabHost(B activity)?

开发者 https://www.devze.com 2023-03-22 22:55 出处:网络
i\'m trying to pass a parameter from a activity Main, to the tabs开发者_开发百科 of a MyTabWidget activity.

i'm trying to pass a parameter from a activity Main, to the tabs开发者_开发百科 of a MyTabWidget activity.

How to do it?


Add data to the intent you are starting MyTabWidget activity and in onCreate() get the data.

Put example

myIntent.putInt("MyInt", 2);

Get example in onCreateMethod()

getParent().getIntent().getExtra().getInt("MyInt");


One way is to send a broadcast from the main activity and to register a BroadcastReceiver in your TabActivity. I don't think it is the best solution, but I couldn't find anything else that worked.

0

精彩评论

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