当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Error NullPointerexception Custom Actionbar

问题描述:

i am getting an error NullPointerException at Actionbar.setCustomView();

im my class i am extending with Collection can anyone help me ?

网友答案:

check your Actionbar object if its null and build up from there. How do you get the Actionbar object?

网友答案:

Use this,

ActionBar ab = getActionBar();
ab.setCustomView(view);

Note: Actionbar works only in Android 3.0 and above.. Still if you need Actionbar in other devices (Android 2.3 and below) as well, use ActionbarSherlock (http://actionbarsherlock.com/) to achieve it.

分享给朋友:
您可能感兴趣的文章:
随机阅读: