When onActivityResult called, coroutine context is not yet created

293 views Asked by At

I am using Conductor (https://github.com/bluelinelabs/Conductor) for Android to replace Fragments. I was implementing image picking in my app and realized that onActivityResult is called before Controller's onAttach, in case of Fragments, equivalent would be onResume. It would be fine, but my problem is that I use coroutines and the coroutine context is created when my presenter is attached (which is a presenter.attach() call from onAttach of Controller (onResume of Fragment)). From onAcitivtyResult I call a function that saves the selected image path to a database. This call requires context to be already be created. I was wondering what people do in this situation. If I am not mistaking, in Fragments, onActivityResult is also called before onResume, so this question is probably not specific to Conductor.

0

There are 0 answers