getActionBar().setDisplayHomeAsUpEnabled(true); throws NullPointerException on new activity creation (Google - Basic Tutorial)

前端 未结 7 2024
自闭症患者
自闭症患者 2020-12-11 00:53

I am following this tutorial and getting a NullPointerException at the onCreate method of the DisplayMessageActivity at this block of code:

if (Build.VERSION         


        
7条回答
  •  再見小時候
    2020-12-11 01:18

    You must have set some theme with your Activity which is not compatible with the Action bar.

    So just check the theme you are using with in your manifest file and remove it

    or if you have defined custom theme go to your res->values->style.xml and make WindowActionBar to true.

提交回复
热议问题