Christopher Francisco
Christopher Francisco

Reputation: 16258

getSupportActionBar using FragmentActivity

I'm using fragment activity on one project, but it seems v4 support FragmentActivity doesn't has getSupportActionBar() method, and I need to use the support one in order to use android.support.v7.app.ActionBar

Upvotes: 18

Views: 24036

Answers (4)

Chetan Pawar
Chetan Pawar

Reputation: 404

Just use this.getActionBar() to get action bar

Upvotes: 1

lgallard
lgallard

Reputation: 462

Sameera getSupportActionBar() is the new way to get the ToolBar. In fact, ActionBar is now deprecated in Google Material Design.

Upvotes: 0

everson
everson

Reputation: 37

to use getSupportActionBar() you need extends ActionBarActivity like this http://antonioleiva.com/actionbarcompat-how-to-use/

Upvotes: 0

Thijs Mergaert
Thijs Mergaert

Reputation: 399

The ActionBarActivity does support the method you require, and is a subclass of FragmentActivity. See: http://developer.android.com/reference/android/support/v7/app/ActionBarActivity.html

Upvotes: 28

Related Questions