问题描述:

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.

相关阅读:
Top