NullPointerException with android.support.v7.widget.Toolbar

后端 未结 12 886
旧巷少年郎
旧巷少年郎 2021-01-07 17:53

I am currently trying to implement a navigation drawer in my app. I am having an issue with the Toolbar being null. I have done many searches online and tried many different

12条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-07 18:12

    In my case , i was trying to access the Toolbar inside onAttach() method of a fragment instead of onActivityCreated() , resulting in NullPointerException.

提交回复
热议问题