getActionBar().setTitle(); Java.lang.NullPoint异常解决方案

getActionBar().setTitle(); Java.lang.NullPoint异常解决方案,是由于低版本不支持直接获取的缘故,修改方案:

 

try changing your theme to this

<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">

and not the AppCompat Version

  

另外一种情况,如果是低版本,API低于11的解决方案:

 

It basically depends on whch api you are targeting.If it less than 14 use
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
and in your activity call your actionbar using this

getSupportActionBar().setDisplayHomeAsUpEnabled(true);

  

你可能感兴趣的:(Actionbar)