How to add two android: name attributes
My current AndroidManifest contains an ORAR Sugar declaration as follows
<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 a jar library.
and now I need to add a declaration for the global variable as shown here Android global variable which does not add
application android:name="MyApplication" android:icon="@drawable/icon" android:label="@string/app_name">
to the existing section of the application. but that means two parts of the application or two "android: name" which is completely wrong. How to implement this scenario in a two-part application
source to share
All you need is just extend com.orm.SugarApp
in your class MyApplication
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 use yours MyApplication
in your manifest:
<application android:name="MyApplication" android:icon="@drawable/icon" android:label="@string/app_name">
source to share
If you want to use sugar-orma and multidex as android: name, you can link below for an example.
import android.content.Context;
import android.support.multidex.MultiDex;
import com.orm.SugarApp;
public class MyApplication extends SugarApp {
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Here I have extended MyApplication with com.orm.SugarApp and inside that Multidex is installed and the next part includes MyApplication in android: name = "MyApplication" in Application tag as shown below
<application
----------
----------
android:name="MyApplication"/>
source to share