I am using bottom navigation in my layout but when I try to write an on Click for it in my main activity oncreate it gives me an exception:
Attempt to invoke virtual method on a null object reference private BottomNavigationView bottomNavigationView;
@Override
protected void onCreate(Bundle savedInstanceState) {
bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottom_nav);
super.onCreate(savedInstanceState);
bottomNavigationView.setOnNavigationItemReselectedListener(new BottomNavigationView.OnNavigationItemReselectedListener() {
@Override
public void onNavigationItemReselected(@NonNull MenuItem item) {
}
});