Android Activity :: onCreate在Application.onCreate之前调用 [英] Android Activity::onCreate called before Application.onCreate

查看:95
本文介绍了Android Activity :: onCreate在Application.onCreate之前调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在某些情况下,我可以看到在创建Appication对象之前(在调用Application.onCreate之前)调用了Activity.onCreate.有可能吗?

In some cases I can see that Activity.onCreate is called before the Appication object gets created (before Application.onCreate is called). Is that ever possible?

推荐答案

可能是您忘记了在清单文件中添加应用程序类.

May be you forgot to add your application class in manifest file.

将您的应用程序类放在< application> 标记下的 AndroidManifest.xml 类中.

Place your application class in AndroidManifest.xml class under <application> tag.
i.e.,

<application
    android:name=".{YourApplicationClassName}"
    ...
    ...

这篇关于Android Activity :: onCreate在Application.onCreate之前调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆