定制android.app.Application不触发OnCreate事件 [英] custom android.app.Application not firing onCreate event
本文介绍了定制android.app.Application不触发OnCreate事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得出从android.app.Application自定义应用程序,我无法得到它的onCreate事件被解雇。下面是实施
进口android.app.Application;
公共类MyApplication的扩展应用{
公共所有MyApplication(){
超();
}
@覆盖
公共无效的onCreate(){
super.onCreate();
}
}
和这里是我如何使用它:
所有MyApplication CTRL =新MyApplication的();
解决方案
添加在下面的的AndroidManifest.xml
<应用
机器人:名称=所有MyApplication
机器人:可调试=真
机器人:图标=@可绘制/图标
机器人:标签=@字符串/ APP_NAME>
< /用途>
那么你的的onCreate()
将被解雇。
I'm deriving a custom application from android.app.Application and I can't get its onCreate event being fired. Here's the implementation
import android.app.Application;
public class MyApplication extends Application {
public MyApplication() {
super();
}
@Override
public void onCreate() {
super.onCreate();
}
}
And here's how I'm using it:
MyApplication ctrl = new MyApplication();
解决方案
Add following in your AndroidManifest.xml
<application
android:name="MyApplication"
android:debuggable="true"
android:icon="@drawable/icon"
android:label="@string/app_name">
</application>
then your onCreate()
will get fired.
这篇关于定制android.app.Application不触发OnCreate事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文