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

前端 未结 7 2018
自闭症患者
自闭症患者 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:29

    I encountered this error when I was trying out the navigation drawer sample app available at the android developer site. It turns out the MainActivity did not extend the ActionBarActivity and thus getActionBar() returns null causing the exception.

    0 讨论(0)
提交回复
热议问题