Skip to content
Advertisement

NavigationView header image

I need to change NavigationView header image from fragment, but i am getting error. Someone can tell me what i am doing wrong?. Thank you for helping)))

java.lang.NullPointerException: Attempt to invoke virtual method ‘android.view.View android.support.design.widget.NavigationView.getHeaderView(int)’ on a null object reference

My Fragment code

JavaScript

navigation header xml

JavaScript

activity_main

JavaScript

Advertisement

Answer

The view you are referring here is your fragment which is not the container of the navigation drawer

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement