ERJAN
ERJAN

Reputation: 24500

What happens to app name if android:label is not specified in android manifest?

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?

Upvotes: 1

Views: 2047

Answers (2)

Parth Bhayani
Parth Bhayani

Reputation: 1924

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.

Upvotes: 1

ERJAN
ERJAN

Reputation: 24500

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!

Upvotes: 0

Related Questions