<application>

This element is the declaration of the application. It contains subelements that declare the components existing in the application. The following code demonstrates the use of <application>:

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".GameActivity" />
</application>

The <application> element in the preceding snippet makes use of four attributes. These attributes are:

  • android:allowBackup: It is used to specify whether the application is allowed to take part in the backup and restore infrastructure. When set to true, the application can be backed up by the Android system. Otherwise, if this attribute is set to false, no backup of the application will ever be created by the Android system.
  • android:icon: It specifies the icon resource for the application. It can also be used to specify icon resources for application components.
  • android:label: It specifies a default label for the application as a whole. It can also be used to specify default labels for application components.
  • android:roundIcon: It specifies an icon resource to be used when a circular icon resource is required. When an app icon is requested by a launcher, the Android framework returns either android:icon or android:roundIcon; which is returned depends on the device build configuration. As either can be returned, it is important to specify a resource for both attributes.
  • android:supportsRtl: It specifies whether an application is willing to support right-to-left (RTL) layouts. The application is set to support it when this attribute is set to true. Otherwise, the application does not support RTL layouts.
  • android:theme: It specifies a style resource defining a default theme for all activities in the application.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.226.121