Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add two android:name attributes

My current AndroidManifest contain Sugar ORM declaration as follow

<application
    android:name="com.orm.SugarApp"

as stated in their documentation at http://satyan.github.io/sugar/getting-started.html. and it is included as jar library.

and now i need to add declaration for a global variable as illustrated here Android global variable which neeed to add

application android:name="MyApplication" android:icon="@drawable/icon" android:label="@string/app_name">

to existing application section. but this means two application sections or two "android:name" which is totally wrong. How to implement this scenario of two applications parts

like image 750
Eslam Sameh Ahmed Avatar asked Dec 08 '22 05:12

Eslam Sameh Ahmed


1 Answers

All you need is just extends com.orm.SugarApp in your MyApplication class like this:

public class MyApplication extends com.orm.SugarApp {

    @Override
    public void onCreate() {
        super.onCreate();
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
    }

    private String someVariable;

    public String getSomeVariable() {
        return someVariable;
    }

    public void setSomeVariable(String someVariable) {
        this.someVariable = someVariable;
    }
}

And the use your MyApplication in the manifest:

<application android:name="MyApplication" android:icon="@drawable/icon" android:label="@string/app_name">
like image 124
romtsn Avatar answered Jan 20 '23 08:01

romtsn