I'm getting handleWindowVisibility: no activity f...
# compose
m
I'm getting handleWindowVisibility: no activity for token android.os.BinderProxy, when trying to launch an activity within a compose activity. Is it possible to define a function that gets a composable function as a parameter and launches an activity that uses that function? This will allow to have modal windows that can be reused across the app. Like lets say edituser(id user)=launchactivity(composable userUI). Like having a helper activity just to display a modal window.
a
It sounds like you're looking for dialogs rather than activities, and yes there are early compose dialog APIs present
Activities with that kind of structure are problematic since they must be launched via intent; they're application entry points.
m
Well yes if I'm free to design the dialog at my will, textfields,spinners, icons whatever ..... but apparently I'm limited to a very short set of things (title,text...). Regardless of being an activity or a dialog, what I would like is to build a user interface and show it modally ...
a
You are free to design the dialog with any content you wish. Starting an activity from your current activity context will remain an imperative operation.
Check the
Dialog
composable in the foundation package 🙂
m
Thank you I'm sorry I was biassed by AlertDialog , and about the imperative issue, I'm not absolutely convinced that it is imperative not to be imperative, what it is imperative is to make programmers life easier, I really love the compose paradigm what I was asking for is a kind of imperative pipes between non imperative UI. After all when you want to edit let's say a User, this is an imperative command, but how you perform that edition it is not. A kind of mix.
a
apologies, I meant imperative in the imperative programming sense, as compared to declarative like much of the rest of compose. 🙂
164 Views