Starting Fragment activity from an activity causes NullPointerException

Your chipNavigationBar variable is null and therefore the OnItemSelectedListener is instantiated with null, which is not possible.

You try to find your chipNavigationBar in the Dashboard, but you haven’t even set setContentView(R.layout.yourLayout);, which means that it is not possible to find the ViewById.

You have to instatiate the variable in your fragment, where you have a valid view.

chipNavigationBar = findViewById(R.id.bottom_nav_menu);

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top