2

i'm working with Volley lib and Sugar ORM. Each one oblige me to set it as my application in AndroidManifest.XML

   <application
    android:name="pixels.myapp.app.AppController" // application 1
    android:name="com.orm.SugarApp" // application 2 
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <meta-data
        android:name="DATABASE"
        android:value="myapp.db" />
    <meta-data
        android:name="VERSION"
        android:value="2" />
    <meta-data
        android:name="QUERY_LOG"
        android:value="true" />
    <meta-data
        android:name="DOMAIN_PACKAGE_NAME"
        android:value="pixels.myapp" />

I know that is not possible to declare 2 application in the same Manifest but is there anyway to do that .

  • You need your own app class with init() called for both Volley lib and Sugar ORM. You don't have to use their app classes – Stan Apr 22 '15 at 11:12

1 Answers1

3

Since com.orm.SugarApp is extending from Application class, you can simply inherit your Volley's AppController from SugarApp, like this:

public class AppController extends com.orm.SugarApp {
    //your controller logic
}
romtsn
  • 11,704
  • 2
  • 31
  • 49
  • Not possible cause AppController extends Application – Omar Mahdoui Apr 22 '15 at 11:20
  • SugarApp is also extending Application. so If you will extending SugarApp, you will also extending Application. Just change `extends Application` to `extends com.orm.SugarApp` and that's it. – romtsn Apr 22 '15 at 11:22
  • i need to get the context as a parameter in it but my app crashes . i have used getapplicatincontext as well as getbasecontext .. so can resolution with.. i need it because i want to use parse along with sugar – vaibhav May 19 '15 at 11:20