I want to change the name of the application which is defined in application tag like:
<application android:icon="#drawable/icon" android:label="#string/app_name">
Here the label is defined in resource xml, but what I want to achieve is that user input app_name of his choice and save it and then this new name should be used on Home or Launcher screen of device.
I know there is a way to do by using ActivityAlias but again the label is pre-defined and it's not a dynamic way to do it.
I read some articles that there are some apps like Magisk which changes it's app name & package name through user input.
Related
Is activity title or name visible to users in recent apps screen in some version of android?
It is the application name that is visible to user. No matter what the title is!
You can set it from AndroidManifest.xml in the application section. Reference.
<application>
android:label="App name here"
...
</application>
I have the following in my android manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="nis.history_card_game" >
<application
android:allowBackup="true"
android:icon="#mipmap/history"
android:theme="#android:style/Theme.Holo.Light.NoActionBar.Fullscreen">
<activity
android:name=".Battlefield">
</activity>
<activity
android:name=".ChooseHero">
</activity>
</application>
For some reason my app is called nis.history.card_game So what happens if in application tag android:label is missing?
I think the activity tag with the attribute android:label is not necessary, except you want make the activity the title different with the application label, you can use your own label. the default should be as same as the application label.
Elements of the AndroidManifest.xml file
The elements used in the above xml file are described below.
manifest
manifest is the root element of the AndroidManifest.xml file. It has package attribute that describes the package name of the activity class.
application
application is the subelement of the manifest. It includes the namespace declaration. This element contains several subelements that declares the application component such as activity etc.
The commonly used attributes are of this element are icon, label, theme etc.
android:icon represents the icon for all the android application components.
android:label works as the default label for all the application components.
android:theme represents a common theme for all the android activities.
activity
activity is the subelement of application and represents an activity that must be defined in the AndroidManifest.xml file. It has many attributes such as label, name, theme, launchMode etc.
android:label represents a label i.e. displayed on the screen.
android:name represents a name for the activity class. It is required attribute.
intent-filter
intent-filter is the sub-element of activity that describes the type of intent to which activity, service or broadcast receiver can respond to.
action
It adds an action for the intent-filter. The intent-filter must have at least one action element.
category
It adds a category name to an intent-filter.
I dont' know WHY this happens - in case android:label attribute is missing, the system automatically assigns the package name. No idea why this happens - might be just convention from Google.
But the solution is just to add label in tag, not above!
I have an app with a difficult name that the system's built-in speech recognizer is not able to properly understand. For this reason, assuming that my app is called X, I would like to be able to launch it by saying "Start Y."
As described in the official documentation, the name of the app is defined in the manifest:
<application
...
android:label="X" > ... </application>
while the text to say after the "Start" command is defined here:
<activity
...
android:label="Y" > ... </activity>
However in doing so the name of the app in the app list becomes Y, while I would like it to remain X...
The only thing you can do is to use an activity alias with a different label. In this case the user will see two icons in the list.
My application starts a service that keep running in background. Service class "ConnSrv" is not descriptive enough for users. How can I set service name that shown in OS taskmanager?
android:label generally controls the display names of components:
On an <activity>, it controls things like the caption associated with a launcher icon, or the default title in the action bar
On a <receiver>, it controls things like the display name of an app widget in the device's roster of available app widgets
On a <service>, it apparently covers how the service is named in the list of running services (I never tried this, which is why I started with a comment...)
On an <application>, not only does it control things like the name in the installed apps list in Settings, but it provides the default for all <activity>, <receiver>, and <service> elements that do not override it
I want to change android application name programatically. Is there any API to do this? Thanks.
You cant do it pragmatically.its static.Go to menifest file and add android:label="Your application name" in application tag like below
<application
android:icon="#drawable/ic_launcher"
android:label="Your application name">
You can't change the app name programatically. It is in the manifest. Why do you want to do that anyways?
You could try to change the name using Antscripts, but this could just happen during devTime.
The appname itself does stand in the manifest.xml:
<application android:label="My App name">
Mostly its refered to the R.String file.
Otherwise as codeBegin already said, use setTitle("AppName") to change the title in the current activity.
If you really want to change the name of the WHOLE app, this would NOT be possible, just imagine what a chaos will be created if apps are renamed frequently ;)