Learning Android Development

Building A Jetpack Compose Window With AbstractComposeView

Beyond normal Jetpack Compose Development, e.g. building Tooltip, Coachmark, Custom Toast, etc.

Photo by Samuel T on Unsplash

Sometimes, don’t we wish we click a Button, and we can open up a Window View, and display some Jetpack Compose drawn interface? I call this Jetpack Compose Window.

Illustration of when one click a Button, we like to open a Jetpack Compose Window

A quick thought we have is, we can launch a new Android Activity or Fragment. But these are a little bigger than what we need.

The other way is, can launch a Jetpack Compose Dialog or Popup. These are the 2 special window-like components Jetpack Compose provided us.

But if these are still not meeting our needs, e.g. we like to make a custom Toast, Tooltip, Coachmark, or small little Window that can auto dismissed, or be queued (using Kotlin Flow), can we build our own version of Jetpack Compose Window?

The short answer is YES. We can use AbstractComposeView to do so.

The normal use of AbstractComposeView

--

--