1

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.

  • 7
    Possible 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 Answers2

6

Try to use this.setTitle(title); in onCreate() method.

Sky
  • 1,435
  • 1
  • 15
  • 24
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