I am new in Android. I want to build an app with tab format. I found many documentation where Activity
has been used. Also in many cases have used FragmentActivity
. I am not sure which will be better to start. Please suggest me should I use Activity
or FragmentActivity
to start development in tab format?
This question is related to
android
android-activity
android-fragmentactivity
If you use the Eclipse "New Android Project" wizard in a recent ADT bundle, you'll automatically get tabs implemented as a Fragments. This makes the conversion of your application to the tablet format much easier in the future.
For simple single screen layouts you may still use Activity
.
FragmentActivity
gives you all of the functionality of Activity
plus the ability to use Fragments which are very useful in many cases, particularly when working with the ActionBar, which is the best way to use Tabs in Android.
If you are only targeting Honeycomb (v11) or greater devices, then you can use Activity
and use the native Fragments introduced in v11 without issue. FragmentActivity
was built specifically as part of the Support Library to back port some of those useful features (such as Fragments) back to older devices.
I should also note that you'll probably find the Backward Compatibility - Implementing Tabs training very helpful going forward.
Source: Stackoverflow.com