Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between ActionBarActivity and Fragment Activity

I am noob in Android. I just started to use ActionBarActivity over FragmentActivity. Is there any difference between them ??

like image 380
Mick Avatar asked Apr 13 '14 16:04

Mick


People also ask

What is the difference between fragment and fragment activity?

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.

What is difference between activity and AppCompatActivity?

Activity is the basic one. Based on Activity , FragmentActivity provides the ability to use Fragment . Based on FragmentActivity , AppCompatActivity provides features to ActionBar .

What is difference between activity and FragmentActivity?

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.

Which one is better fragment or activity?

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.


1 Answers

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

like image 121
Raghunandan Avatar answered Sep 30 '22 17:09

Raghunandan