How to pass paramters from Activity A, to the tabs of a TabHost(B 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.
精彩评论