My android app has a toolbar and I wan to change the title of it. I used toolbar.setTitle() but it is not working... Please help. What should I do? I tried getSupportActionBar().setTitle() but it doesn't work.
Asked
Active
Viewed 124 times
1
-
7Possible duplicate of [In android app Toolbar.setTitle method has no effect – application name is shown as title](http://stackoverflow.com/questions/26486730/in-android-app-toolbar-settitle-method-has-no-effect-application-name-is-shown) – M Monis Ahmed Khan May 09 '17 at 07:16
2 Answers
1
Use below code to set the title
Toolbar mActionBarToolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
setSupportActionBar(mActionBarToolbar);
getSupportActionBar().setTitle("My title");

Sandeep dhiman
- 1,863
- 2
- 17
- 22