简体   繁体   English

应用程序可以在Application.onCreate()之前获取Fragment.onAttached()吗?

[英]Can the app get Fragment.onAttached() before Application.onCreate()?

Is there any dependency between Application's and Activity's/Fragment's lifecycle? 应用程序和活动/片段的生命周期之间是否有任何依存关系? Is it possible to get Activity.onCreate() or Fragment.onAttached() before Application.onCreate() ? 是否可以在Application.onCreate()之前获取Activity.onCreate()Fragment.onAttached() Application.onCreate()

Is there any dependency between Application's and Activity's/Fragment's lifecycle? 应用程序和活动/片段的生命周期之间是否有任何依存关系?

The Application singleton for your process will be created before any activities, let alone fragments. 您的流程的Application单例将在任何活动之前创建,更不用说片段了。

Is it possible to get Activity.onCreate() or Fragment.onAttached() before Application.onCreate()? 是否可以在Application.onCreate()之前获取Activity.onCreate()或Fragment.onAttached()?

Not in any conventional scenario. 在任何常规情况下都没有。

No, it is not possible. 不,不可能。 Refer the mention in documentation below for onCreate method of Application class. 请参阅以下文档中有关Application类的onCreate方法的提及。

public void onCreate() 公共无效onCreate()

Called when the application is starting, before any activity, service, or receiver objects (excluding content providers) have been created 在应用程序启动时,创建任何活动,服务或接收者对象(内容提供者除外)之前调用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Application.onCreate代码之前调用NotificationListenerService - NotificationListenerService called before Application.onCreate code 为什么 ContentProvider.onCreate() 在 Application.onCreate() 之前被调用? - Why does ContentProvider.onCreate() get called before Application.onCreate()? 如果应用程序闲置了数小时并被OS破坏,是否在Activity.onResume之前调用Application.onCreate? - Is Application.onCreate called before Activity.onResume if app has been idle for hours and destroyed by OS? Android Activity::onCreate 在 Application.onCreate 之前调用 - Android Activity::onCreate called before Application.onCreate 在Application.onCreate()上的BroadcastReceiver - BroadcastReceiver on Application.onCreate() 在BroadcastReceiver.onReceive(..)之前是否会调用Application.onCreate(Bundle)? - Will Application.onCreate(Bundle) be called before BroadcastReceiver.onReceive(..)? Android冷应用启动:如何优化Application.onCreate的时间? - Android cold app start: How to optimise time to Application.onCreate? Application.onCreate() 时保存 Android App 的 ApplicationContext - Save Android App's ApplicationContext when Application.onCreate() Android - 我可以在Application.onCreate()中使用LocalBroadcastManger注册广播吗? - Android - Can I register the broadcast with LocalBroadcastManger in Application.onCreate()? Application.onCreate被多次调用 - Application.onCreate called more than once
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM