askIT

Android Navigation drawer fragments set title to toolbar

The title to the toolbar can be changed in the onCreate method.

MainActivity.class

/* Set title */
// toolbar.setTitle("Diet");
this.setTitle("Home");

...Fragment.class

/* Set title */
((MainActivity)getActivity()).getSupportActionBar().setTitle("Some other title");

Add comment

avatar_blank_60.png

Comment:

Name:

Email:

Comments

No comments yet. You can be the first one to comment. Just write your comment in the form and click on the submit button.