简体   繁体   中英

How can i specify more than 1 custom application as my application in AndroidManifest.xml?

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 .

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
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM