When I try to use getActionBar() it says it is deprecated, so that means by going forward we are not allowed to use getActionBar().
Which
The reason you should create this, because Fragment Tabs using ActionBar is now deprecated. This is new way to create your actionbar with Material Design. to use this you need to add dependencies in your build.gradle file.
compile 'com.android.support:appcompat-v7:21.0.0'
create toolbar app_bar.xml file, you can give the name you want.
Make sure, you selected theme in styles.xml with
"Theme.AppCompat.NoActionBar"
after that, you need to initialize this toolbar in your mainActivity.xml layout file, for that include this,
then in the MainActivity, you need to make instance of Toolbar toolbar. then, after setContentView() add following with your
toolbar = (Toolbar) findViewById(R.id.app_toolbar);
setSupportActionBar(toolbar);