Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setHomeButtonEnabled(boo

Posted 令生

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setHomeButtonEnabled(boo相关的知识,希望对你有一定的参考价值。

android】getActionBar()为null的解决方法总结

setContentView(R.layout.activity_main);
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setIcon(R.mipmap.ic_launcher_finish);

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.qindou.currenciesnc/com.qindou.currenciesnc.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method ‘void android.support.v7.app.ActionBar.setHomeButtonEnabled(boolean)‘ on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper

这个又是版本的问题吗?山高路远坑深啊!

 













以上是关于Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setHomeButtonEnabled(boo的主要内容,如果未能解决你的问题,请参考以下文章

Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setHomeButtonEnabled(boo

java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.yunweather.

java.lang.NullPointerException: Attempt to invoke virtual method ‘int android.database.sqlite异常(代码片段

Attempt to invoke virtual method 'void com.loopj.android.image.SmartImageView.setImageUrl(java.l

Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a nu

Android报错提示Attempt to invoke interface method ‘int java.util.List.size()‘ on a null object reference