Problem in opening Sub Activity of ActivityGroup

匿名 (未验证) 提交于 2019-12-03 01:05:01

问题:

I am working with ActivityGroup and I want to open an sub activity of the ActivityGroup on selection of another tab. Please anyone let me know if it is possible or not?

example - I have tab1 and I open a subActivity(say activity "A") in the same tab using ActivityGroup and now when I click on tab2 I should open the same Activity "A" with all its contents.

Thanks in Advance.

回答1:

I really, strongly urge you to stop using ActivityGroup. This has been deprecated.

The fragment support library provides a much better way to do these things. The 3.2 version includes an example showing how to use it with the tab widget. See the "Fragment Tabs" example and the TabActivity documentation.

These can be used down to Android 1.6.

(There are also lots of demos there for other things you can do with fragments.)



回答2:

This is how I thing it can be done :

open the sub-activity just as normally you do, create certain static variable to hold data between two opened activities, be it static bundle or strings, when ever you perform some action on activity ex: type some thing in edit text, save the content in those static variables, in the onResume of the activity, put those data from variables in views........


See if it works........



回答3:

Try this code,

http://developer.android.com/resources/tutorials/views/hello-tabwidget.html

if not found helpful then please provide me some more details about flow and if possible then put your (xml/java) code. so i can clearly understand the problem.

Let me know it's useful for you or not by comment ?



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!