spierce702/02/2021, 11:06 PM
composable to embed a native Android View into Jetpack Compose. However, I’d when a certain event happens on my model, I’d like to re-create the
, removing the old, and replacing it with a newly created one. How would I go about doing that?
jim02/02/2021, 11:26 PM
But I'm a bit suspicious of your framing "when an event occurs", as it tends to indicate that you are thinking in an imperative way instead of a declarative one. Instead, consider how your data model needs to be updated when the event occurs, and how that data model gets rendered to the screen. This might be "when a user clicks the 'new' button, I create a new empty contact card with a new UUID", and then the key around your AndroidView would be
. Without more details, I can't tell you what your key should be, but I can tell you that your question implies you're thinking about the problem imperatively.
spierce702/02/2021, 11:55 PM
But I’m a bit suspicious of your framingGood call. I’m using exoplayer, and exoplayer seems to have a bug when updating playlists. Sometimes it gets stuck and doesn’t play, even after calling
. The best way to guarantee this doesn’t happen I’ve found is just to reload the screen. Another way, is just to re-create the Exoplayer View.
jim02/03/2021, 12:00 AM
Adam Powell02/03/2021, 12:31 AM