I am noob in Android. I just started to use ActionBarActivity
over FragmentActivity
. Is there any difference between them ??
Let's dive into the difference Activity is an application component that gives a user interface where the user can interact with your application, whereas fragment is part of your activity embedded into it and has its UI with its elements.
Activity is the basic one. Based on Activity , FragmentActivity provides the ability to use Fragment . Based on FragmentActivity , AppCompatActivity provides features to ActionBar .
FragmentActivity is part of the support library, while Activity is the framework's default class. They are functionally equivalent. You should always use FragmentActivity and android.
Activities are an ideal place to put global elements around your app's user interface, such as a navigation drawer. Conversely, fragments are better suited to define and manage the UI of a single screen or portion of a screen.
FragmentActivity
is the base class for support based fragments. So you will be using Fragment
from support library below api level 11 in which case your Activity
needs to extend FragmentActivity
.
↳ android.support.v4.app.FragmentActivity
↳ android.support.v7.app.ActionBarActivity
You will use ActionBarActivity
when you need actionbar below API level 11 by using AppCompat library. In this case your Activity extends ActionBarActivity
.
As you see ActionBarActivity
extends FragmentActivity
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With