[Android Jetpack] Creating Fullscreen Loading dialog using Jetpack Compose.

Atiar Talukdar
1 min readOct 11, 2022

A very simple but useful content. Something that can save your few hours of development time.

I’ll share a simple code that will help you create a common fullscreen loading screen in your whole project.

  1. We will create a LoadingIndicator Composable function
  2. Will use that function to create the loading screen
  3. will add a preview function as well.
  4. DialogContent
@Composable
fun DialogContent() {
Box(
modifier = Modifier
.size(76.dp)
.background(
color = Color.White,
shape = RoundedCornerShape(4.dp)
)
) {
CircularProgressIndicator(
modifier = Modifier
.align(
Alignment.Center
),
color = Color.Red
)
}
}

2. Using DialogContent creating a fullscreen loading screen.

@Composable
fun LoadingDialog(isShowingDialog: Boolean, dismissOnBackPress: Boolean = false, dismissOnClickOutside: Boolean = false) {
if (isShowingDialog) {
Dialog(
onDismissRequest = { },
DialogProperties(
dismissOnBackPress = dismissOnBackPress,
dismissOnClickOutside = dismissOnClickOutside
)
) {
DialogContent()…

--

--

Atiar Talukdar

Specialty on Idea to Market Ready Software | Mobile Applications Developer | Project Manager