Android : Change App Label programmatically
It's not possible by the moment. It is a fixed string in the AndroidManifest.xml file which cannot be changed at runtime.
How to change an Android app's name?
Yes you can. By changing the android:label
field in your application node in AndroidManifest.xml
.
Note: If you have added a Splash Screen and added
<activity
android:name=".SplashActivity"
android:label="@string/title_activity_splash_screen"
android:theme="@style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
to your Splash Screen, then the Launcher Icon name will be changed to the name of your Splash Screen Class name.
Please make sure that you change label:
android:label="@string/title_activity_splash_screen"
in your Splash Screen activity in your strings.xml file. It can be found in Res -> Values -> strings.xml
See more here.
Android: programmatically change the application label?
That is read-only, AFAIK.
If your objective is to change the title bar of your activities, you can call setTitle()
.
Android change the name of app which is to installed on homescreen
Android label tag is used for both Default Title bar and App Name in Home Screen
android:label="@string/app_name"
If you want to change only App Name then change label and set Title Bar Text to your desire in onCreate() in your activity as below:
this.setTitle("Your Title");
Hope this helps.
After the app icon and app name changed programatically, then after minimizing the app the application not found in background
Create such config in Manifest.xml
<activity android:name="package.name.MainActivity"
android:screenOrientation="portrait"
android:label="@string/app_name"
android:theme="@style/CustomTheme"
android:launchMode="singleTask">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity-alias android:label="@string/app_name_default"
android:icon="@drawable/icon_default"
android:name=".MainActivity-Default"
android:enabled="true"
android:targetActivity=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias android:label="@string/app_name_flavor_one"
android:icon="@drawable/icon_flavor_one"
android:name=".MainActivity-Flavor-One"
android:enabled="false"
android:targetActivity=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
Now you can switch between those two aliases, therefore we will change app icon or/and name. To switch from Default to Flavor-One use this code.
getPackageManager().setComponentEnabledSetting(
new ComponentName("package.name", "package.name.MainActivity-Flavor-One"),
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
getPackageManager().setComponentEnabledSetting(
new ComponentName("package.name", "package.name.MainActivity-Default"),
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
Keep in mind that you have to track that only one alias will be enabled at a time
How can I change the app display name build with Flutter?
UPDATE: From the comments this answer seems to be out of date
The Flutter documentation points out where you can change the display name of your application for both Android and iOS. This may be what you are looking for:
- Preparing an Android App for Release
- Preparing an iOS App for Release
For Android
It seems you have already found this in the AndroidManifest.xml
as the application
entry.
Review the default App Manifest file AndroidManifest.xml located in
/android/app/src/main/ and verify the values are correct,
especially:application: Edit the android:label in the application tag to reflect the final name of the
app.
For iOS
See the Review Xcode project settings
section:
Navigate to your target’s settings in Xcode:
In Xcode, open Runner.xcworkspace in your app’s ios folder.
To view your app’s settings, select the Runner project in the Xcode project
navigator. Then, in the main view sidebar, select the Runner target.
Select the General tab. Next, you’ll verify the most important
settings:Display Name: the name of the app to be displayed on the home screen
and elsewhere.
Related Topics
Rxjava Android How to Use the Zip Operator
Map.Clear() VS New Map:Which One Will Be Better
How to Use Jndi Datasource Provided by Tomcat in Spring
Can CSS in Javafx Be Used for Animations
When Should We Use Observer and Observable
How Apply CSS on a <H:Inputtext>
Difference Between Java.Util.Random and Java.Security.Securerandom
Different War Files, Shared Resources
Javafx - How to Create a Thin Menubar
Creating Runnable Jar with Gradle
Prevent Android Activity Dialog from Closing on Outside Touch
Why Do I Need Transaction in Hibernate for Read-Only Operations
Exposed Beyond App Through Clipdata.Item.Geturi
Why Hypot() Function Is So Slow