Getting a NullPointerException with AppCompat

后端 未结 1 1868
花落未央
花落未央 2021-01-27 00:16

I\'m trying to implements \'Material design\' for pre-5.0 using AppCompat v21, but I\'m getting a null pointer exception when i try to put on the new \'toolbar\'. I followed thi

1条回答
  •  盖世英雄少女心
    2021-01-27 00:47

    Your toolbar.xml is not included in your activity_main.xml and therefore findViewById(R.id.my_awesome_toolbar) returns null - you need to include the Toolbar directly into the layout of each activity.

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