MarkRS
06/19/2023, 9:08 AMMark Murphy
06/19/2023, 12:38 PMHas the order of instantiation of objects (application and activity) changed under compose?Assuming that by "application" you mean the
Application
singleton, then no. That's set by the OS and framework.
How can I get a reference to the application in the init of the activity?If by "init" you mean an
init()
block, that is not possible, as the activity instance is not wired into the rest of the framework yet.
During "onStart" is too late and I haven't seen another method that looks promising.
onCreate()
, after the super.onCreate()
call, happens before onStart()
.MarkRS
06/19/2023, 1:44 PMandroid.app.Activity
public final android.app.Application getApplication()
Return the application that owns this activity.
onCreate seems not to be early enough either 😞Mark Murphy
06/19/2023, 1:59 PMonCreate()
for an Activity
, so you may want to focus on why you think that you need something earlier and why you think Compose is tied into this. For example, if you are trying to reference the Application
from a property initializer, that will not work, but that hasn't worked since Android 1.0.