Reputation: 4022
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
Upvotes: 4
Views: 1492
Reputation: 59
If u want to use sugar-orm and multidex both as android:name,u can refer below 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 extended MyApplication with com.orm.SugarApp and inside this Multidex is installed and next part is include MyApplication in android:name="MyApplication" in Application tag as shown below
<application
----------
----------
android:name="MyApplication"/>
Upvotes: 3
Reputation: 11982
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">
Upvotes: 11