My Problem:
I have a MainActivity
along with its XML
file activity_main.xml
, which contains a NavigationDrawer
view and that view calls a header.xml
file to be displayed in my drawer.
The issue is that my header file contains a button so that when I click the header it opens a site. However since upgrading my Android studio
build tools to 23.0.2
the onClick()
for tht button inside my MainActivity
crashes the app, giving me a NullPointerException
.
I figure that its crashing because the header file is a totally different file from my activity_main.xml
so my MainActivity
would not have direct access to views inside of the header file.
How can I get access to the button that is inside the header.xml
file with and also make it clickable
?