how to Add two android:name attributes to Applicat

2019-04-11 10:43发布

My Android application requires two application classes,one is volley AppController and another one is Analytics class.I am confused how to add both at a time.please help me and get me out of this.

3条回答
我命由我不由天
2楼-- · 2019-04-11 10:52

You need to implement Multilevel inheritance to resolve this scenario.

how to handle multiple application classes in android

查看更多
爷、活的狠高调
3楼-- · 2019-04-11 11:03

You need to implement Multilevel inheritance to resolve this scenario.

This is your scenario

public Lib1Application extends Application{

}

public Lib2Application extends Application{

}

public YourApplication extends Application{

}

How to resolve this?

public Lib1Application extends Application{

}

public Lib2Application extends Lib1Application{

}

public YourApplication extends Lib2Application{

}

finally in mainfest.xml

<application
        android:name="com.your.packagename.YourApplication"
        android:icon="@drawable/ijoomer_luncher_icon"
        android:label="@string/app_name"
 >
查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-04-11 11:05

Make your volley AppController class extend your Analytics application class. Then specify your volley AppController in your manifest.

查看更多
登录 后发表回答