开发者

Run Activity in other tab. Pass parameters to it

Hello I have TabActivity application w开发者_开发问答ith two tabs. One activity get from bundle in OnCreate() method some default patameter and execute logic. On another activity view I have some control which send parameter to first activity with other value. But first activity opens separately without tabs! Ok. Also I can programmatically change current tab, but in this case how to get bundle object? OnStart and onResume callbacks does not have Bundle object.

I can save this parameter in Preferences when I press control, then programmatically change tab an get this parameter from Preferences in other activity. But I think it is wrong way.


You can call your own tab activity again like that

Intent theIntent = new Intent(this, TabActivity.class); 
theIntent.putExtra("targetTab", 3);
startActivity(theIntent);

and to pass data or parameter you can create singleton java class and pass your data to which activity you want.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜