I’m seeing some odd behavior with `CompletableDefe...
# coroutines
s
I’m seeing some odd behavior with
CompletableDeferred
. I’m using it to wrap an Android UI prompt, so I’m setting a
lateinit var CompletableDeferred
before launching the prompt, then completing it from the system callback once the user action is complete. However, the var is always
null
when I try to complete it. Is there an obvious flaw here, or a better approach?
Figured it out!
I was accidentally creating two instances of the class containing the Deferred variable. The first one was kicking off the UI action and waiting for a response, and the second one was swallowing the UI response and wasn’t properly initialized
b
Yeah, an object is still an object as far as
lateinit var
is concerned.