jaqxues
03/13/2021, 9:41 AMandroid.app.Activity?
I see that it requires a ViewTreeLifecycleOwner, which can be instantiated and set manually. However the ViewTreeSavedStateRegistryOwner cannot be instantiated, so it must be used with an AppCompatActivity, right?
Is there any way for me to get a ViewTreeSavedStateRegistryOwner without AppCompatActivity or get Compose (specifically ComposeView, which checks for these) to work?lewis
03/13/2021, 10:56 AMandroidx.activity.ComponentActivityjaqxues
03/13/2021, 10:57 AMGabriel
03/13/2021, 12:11 PMjaqxues
03/13/2021, 12:41 PMMark Murphy
03/13/2021, 12:49 PMHowever thecannot be instantiated, so it must be used with an AppCompatActivity, right?ViewTreeSavedStateRegistryOwner
AppCompatActivity comes from a library. Anything that a library author can write, we can write.
We have examples of using Compose in an InputMethodService (https://stackoverflow.com/a/65760080/115145) and from a service showing a system overlay (https://gist.github.com/handstandsam/6ecff2f39da72c0b38c07aa80bbb5a2f). AFAIK, both copied code out of ComponentActivity and adjusted it to suit their needs.Gabriel
03/13/2021, 12:52 PMjaqxues
03/13/2021, 12:53 PMgetSavedStateRegistry() . I will try itGabriel
03/13/2021, 12:54 PMjaqxues
03/13/2021, 12:55 PMandroid.app.Activity. It is a pretty special use case, i know. And don't try to convince me that I'm doing it wrong, I know that and there is no other way lolGabriel
03/13/2021, 12:55 PM