actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS) deprecated

前端 未结 4 1446
悲哀的现实
悲哀的现实 2020-12-06 13:24

I\'m following the tutorial https://www.youtube.com/watch?v=VVahIc8yENk and I\'m getting the error

java.lang.NullPointerException: Attempt to invoke

4条回答
  •  清歌不尽
    2020-12-06 13:52

    finally i found answer. 1st your android sdk

    
    

    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();

提交回复
热议问题