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
Adam Powell
03/12/2020, 1:42 PM
It sounds like you're looking for dialogs rather than activities, and yes there are early compose dialog APIs present
Adam Powell
03/12/2020, 1:44 PM
Activities with that kind of structure are problematic since they must be launched via intent; they're application entry points.
m
MBegemot
03/12/2020, 3:18 PM
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
Adam Powell
03/12/2020, 6:22 PM
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.
Adam Powell
03/12/2020, 6:24 PM
Check the
Dialog
composable in the foundation package 🙂
m
MBegemot
03/12/2020, 7:27 PM
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
Adam Powell
03/12/2020, 8:51 PM
apologies, I meant imperative in the imperative programming sense, as compared to declarative like much of the rest of compose. 🙂