android API TabActivity deprecation

坚强是说给别人听的谎言 提交于 2019-12-12 11:38:01

问题


Well, im developing and app for api 8 with TabActivity but i found out today that "This class is deprecated."

So we should use FragmentActivity from now to implements tabs? but what about when i want to show a listview with an activity? Do i have to use ListFragment (but this is "Since: API Level 11")

As anyone can see, im confuse about how to move on.

It would be great if someone can provide me good and clear concepts about this issues, tabs, fragment and any other useful advice (AsyncTaskLoader just for api11?)

btw, i was reading that fragment can be use since api 1 but now i can't find that. please help :(

edit: just re change the title cuz ListFragment wasn't deprecated. If i am not suppose to do that, plz sorry newby here :D


回答1:


You can use use android-support-v4.jar to use fragment in lower version

  • Fragments For All
  • Using Fragment of Android Compatibility Package



回答2:


Well, im developing and app for api 8 with TabActivity but i found out today that "This class is deprecated."

In Android, "deprecated" usually means "we will continue to maintain this as long as we can, but there are better options that you should consider". In the case of TabActivity, the long-term plan is for tabs to be in the action bar, which you can use on Android 3.x and higher, and on Android 2.x on down using something like ActionBarSherlock.

So we should use FragmentActivity from now to implements tabs?

Not necessarily, though it is certainly an option.

but what about when i want to show a listview with an activity? do i have t use ListFragment (but this is "Since: API Level 11")

ListFragment is also available in the Android Support package, the same place where you get FragmentActivity.

AsyncTaskLoader just for api11?

AsyncTaskLoader is also available in the Android Support package.

It would be great if someone can provide me good and clear concepts about this issues, tabs, fragment and any other useful advice

That would cover a couple of hundred pages in books. You might consider asking additional questions where you are more specific.

If you have not done so already, please read:

  • http://developer.android.com/guide/topics/fundamentals/fragments.html
  • http://android-developers.blogspot.com/2011/03/fragments-for-all.html



回答3:


Fragments have a support package all the way back to API 4.

API 4 Reference



来源:https://stackoverflow.com/questions/8140691/android-api-tabactivity-deprecation

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