Android java.lang.NullPointerException getActionBar ()

I tried to implement an Setting Activity class but it give’s me back an error:

Caused by: java.lang.NullPointerException
            at com.example.andrei.sunshine.SettingsActivity.setupActionBar(
            at com.example.andrei.sunshine.SettingsActivity.onCreate(

This is the line : getActionBar().setDisplayHomeAsUpEnabled(true);

And the AndroidManifest is :



Please help me

If your SettingsActivity
extend ActionBarActivity
, your getActionBar();
will be available.

public class SettingsActivity extends ActionBarActivity {
    protected void onCreate(Bundle savedInstanceState) {
        //If you use support library

See the documentation
for more info.

Hello, buddy!稿源:Hello, buddy! (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合编程 » Android java.lang.NullPointerException getActionBar ()

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录