android combination of fragmentactivity and listactivity

空扰寡人 提交于 2019-12-25 05:21:56

问题


sorry for may be stupid question, I am a beginner. what can I do if I needed to extend both ListActivity and FragmentActivity in one activity?
I know that I can extend only 1 class, but is there any trick which resolves this?
Thank in advance.


回答1:


you don't have to extended list activity in order to use list , you can include list View inside your layout file




回答2:


No, you cannot extend 2 classes in Java. Could you specify why you need to extend both? My guess is FragmentActivity should suffice for your case.




回答3:


You cannot extend more than one class. You said you're beginner, whenever you dive deeper on how the objects work you'll see that it's simple impossible.

But, to answer the bigger picture of what you're probably trying to achieve:

You want to have one Class that will extend FragmentActivity, and a different class that will extend ListFragment. And whenever the FragmentActivity is created you'll instantiate one of your ListFragments and add it to the layout.



来源:https://stackoverflow.com/questions/11983578/android-combination-of-fragmentactivity-and-listactivity

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