How can I change application label to change app name shown from java code in android? I\'m refering to:
in the activity, i tried
this.setTitle("your text");
and it worked. I hope it's a common solution
In Launcher Activity,Before setContentView()
write this,
setTitle("Your Title");
I don't know how it's possible, But it's surely works.
Application's android:label is a fixed resource referrer.
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.
To anyone interested: Android How to change the application title But it's not clear if it changes the "application label" (that is, the name of the icon in the application list) or only the window title.
As Mister Smith said, it is not possible,
but you could use multiple ActivityAlias
, which can be enabled/disabled dynamically and point to the same targetActivity. Therefore create your chooser for the app name - let the user select one and enable the ActivityAlias
via the packageManager
:
ComponentName componentName = new ComponentName(context, context.getPackageName() + "." + aliasName);
context.getPackageManager().setComponentEnabledSetting(componentName,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP);
To hide the old alias, use the same code with the flag : COMPONENT_ENABLED_STATE_DISABLED
You can also add the possibility to directly add a shortcut to the home launcher, after you enabled the alias. There are plenty ways described here on sow.
It's not possible by the moment. It is a fixed string in the AndroidManifest.xml file which cannot be changed at runtime.