0

In the manifest, I can set application label like this:

<application android:label="@string/app_name" >

But I want to code this, is it possible?

Thanks!

Erick Filho
  • 1,962
  • 3
  • 18
  • 31
  • You can use setTitle() to change the label. – stefana Jan 08 '14 at 12:47
  • possible duplicate of [Android: programmatically change the application label?](http://stackoverflow.com/questions/8991151/android-programmatically-change-the-application-label) – DroidDev Jan 08 '14 at 12:49
  • In what cases do you want to change the label? You could provide several different strings for the label, if, for example, label should change on screen orientation or language. – Stan Jan 08 '14 at 12:51
  • @Stan actually, I have a library project and it holds all strings, and I don't want to keep a string resource file just for app_name in my non-library projects. – Erick Filho Jan 08 '14 at 12:53
  • Can you elaborate on why you want to do this? – Tobrun Jan 08 '14 at 12:53
  • @user1281750 answered above. – Erick Filho Jan 08 '14 at 12:54
  • So you would like more java code then having 1 resource file with one entry.. I really don't see the problem here – Tobrun Jan 08 '14 at 13:00
  • @user1281750 I'm already customizing the Application(already coding), it was supposed to be one line in my ApplicationExtended class. Don't you think it's worth? – Erick Filho Jan 08 '14 at 13:07

2 Answers2

2

No. Because Android application package archive is Read-Only format.

So you can not change the label of the application. Only you can read application label.

user370305
  • 108,599
  • 23
  • 164
  • 151
2

Application's android:label refers to a fixed resource .

But the string under this referrer could have multiple values, depending on configuration qualifier names (values-en, -large, -land, etc.), according to Providing Alternative Resources.

gaurav5430
  • 12,934
  • 6
  • 54
  • 111