user9628944
user9628944

Reputation: 125

how to add application name secondly in manifest

I added first inherited class in manifest

    <application
    android:name=".GlobalApplication"
    android:networkSecurityConfig="@xml/network_security_config"
    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/Theme.AppCompat.Light.NoActionBar">

and I want to add second application ModelViewerApplication.class inherited class because I have to use two application inherited classes.

Upvotes: 0

Views: 54

Answers (1)

Sagar
Sagar

Reputation: 24907

Unfortunately <application> doesn't support multiple Application classes. If you want to add second class extending Application then best you can do is:

public class SecondClass extends GlobalApplication {
...
}

In your manifest

<application
    android:name=".SecondClass"
    android:networkSecurityConfig="@xml/network_security_config"
    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/Theme.AppCompat.Light.NoActionBar"
    >

Upvotes: 1

Related Questions