0

I am only new to android and have a number of classes which extend AppCompatActivity and one GlobalClass to create global variables extending Application. When I add the 'GlobalClass' to the android manifest it doesn't allow it because it extends Application and not AppCompactActivity. Could anyone tell me how to fix it? Thank you for your help.

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.almac.tracker">

<application
    android:label="@string/app_name"
    android:icon="@mipmap/ic_launcher"
    android:theme="@style/AppTheme">

    <activity
        android:name=".Dashboard"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity android:name=".CreateLine">
    </activity>
    <activity android:name=".VerifyLine">
    </activity>

    <activity android:name=".Actforfragmentname">
    </activity>

    <activity android:name=".GlobalClass">
    </activity>
</application>

GlobalClass - extends Application

public class GlobalClass extends Application{

private String name;
public String getName(){
    return name;
}

public void setName(String Name){
    name = Name;
}
Dmitry
  • 5,646
  • 14
  • 33
  • 35
Almac3
  • 63
  • 6

2 Answers2

0

GlobalClass is an Application , not an activity.

     <application
    android:name=".GlobalClass"
    android:label="@string/app_name"
    android:icon="@mipmap/ic_launcher"
    android:theme="@style/AppTheme">
Rose
  • 176
  • 1
  • 1
  • 9
0

GlobalClass is an Application Class , you have add this in application tag like below code

 <application
   android:name=".GlobalClass"<!-- add here your GlobalClass is an Application Class -->
   android:label="@string/app_name"
   android:icon="@mipmap/ic_launcher"
   android:theme="@style/AppTheme">