Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get Navigation View in main activity #2

Closed
lazypixelIn opened this issue Oct 23, 2015 · 2 comments
Closed

how to get Navigation View in main activity #2

lazypixelIn opened this issue Oct 23, 2015 · 2 comments

Comments

@lazypixelIn
Copy link

I am trying To set setNavigationItemSelectedListener on vNavigation in main activity.
but it is giving me nullexception.
please tell me how to do so

@mxn21
Copy link
Owner

mxn21 commented Oct 23, 2015

try to make setNavigationItemSelectedListener in MyMenuFragment$onCreateView.

@OverRide
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_menu, container,
false);
ivMenuUserProfilePhoto = (ImageView) view.findViewById(R.id.ivMenuUserProfilePhoto);
NavigationView vNavigation = (NavigationView) view.findViewById(R.id.vNavigation);
vNavigation.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@OverRide
public boolean onNavigationItemSelected(MenuItem menuItem) {
return false;
}
}) ;
setupHeader();
return setupReveal(view) ;
}

@lazypixelIn
Copy link
Author

that worrks Thank You

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants