Actionbar.setnavigationmode(actionbar.navigation_mode_tabs) Deprecated
Solution 1:
you can use "PagerSlidingTabStrip" replacing "setNavigationMode"
here a tutorial and here a example in Github
Solution 2:
finally i found answer. 1st your android sdk
<uses-sdkandroid:minSdkVersion="11" />
it must higher than 11. 2nd your theme must have actionbar like
android:theme="Theme.AppCompat"
3rd don't use this code in your activity
requestWindowFeature(Window.FEATURE_NO_TITLE);
4th
instead of import android.support.v4.app.ActionBar
use import android.support.v7.app.ActionBar
in your activity
5th
change this actionBar=getActionBar();
to actionbar=getSupportActionBar();
Solution 3:
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setNavigationMode(int)'on a nullobject reference
Your theme apparently is one that does not have an action bar. Since you are not using appcompat-v7
, make sure that you are using a theme that supports the native action bar, such as one of the Theme.Holo
series.
If, instead, you are trying to use appcompat-v7
, you need to inherit from ActionBarActivity
and you need to use getSupportActionBar()
, not getActionBar()
.
Also note that action bar tabs were deprecated as of Android 5.0. You should consider another tab solution, such as the combination of ViewPager
and PagerTabStrip
.
Post a Comment for "Actionbar.setnavigationmode(actionbar.navigation_mode_tabs) Deprecated"