1

Can please someone tell me how to change the App name in the top bar of my android App that gets displayed by default to some other text? I have seen this in a few Apps I used before. I'm building my first Android App and don't have that much experience with this stuff... thank you :)

user8452856
  • 35
  • 1
  • 6

3 Answers3

3

after setContentView(R.layout.layout_name); simply add

setTitle("title_name");

this will change the name of your current activity in top bar or toolbar and i think your activity should extend AppCompactActivity

Anil Shrestha
  • 1,180
  • 11
  • 16
0

it is easier if you convert the actionbar (which I think is the bar you mean) into a toolbar if you want to do further modifications to it (as I assume):

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);    
setSupportActionBar(toolbar);

to change the title then simply call actionbar.setTitle as shown here:

actionBar = getSupportActionBar();
    actionBar.setTitle("Your Title");

and if you want a subtitle add:

    actionBar.setSubtitle("Your Subtitle");
Lukas Schröder
  • 344
  • 1
  • 2
  • 16
0

If you are using the new support library, you should use this:

Toolbar toolber = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(Toolbar);
getSupportActionBar().setTitle("App Title");
Joshua
  • 589
  • 1
  • 5
  • 19