===== 의의 ===== 안드로이드에서 토스트 메시지를 만드는 함수 예제이다. {{:android:안도로이드토스트.png?400|토스트 메시지}} 개발시에 log 대신에 사용해도 괜찮다. ===== 토스트 메시지 만들기 ====== val notification = rememberSaveable { mutableStateOf("") } if (notification.value.isNotEmpty()) { Toast.makeText(LocalContext.current, notification.value, Toast.LENGTH_LONG).show() notification.value = "" } ===== 토스트 메시지 부르기 ===== Text(text = "Cancel", modifier = Modifier.clickable { notification.value = "Cancelled" }) ===== 전체 예제 ===== @Composable fun SettingsPage(modifier : Modifier = Modifier) { val notification = rememberSaveable { mutableStateOf("") } if (notification.value.isNotEmpty()) { Toast.makeText(LocalContext.current, notification.value, Toast.LENGTH_LONG).show() notification.value = "" } Column (modifier = modifier .background(GreenColorJC) .padding(8.dp) .verticalScroll(rememberScrollState()) .safeDrawingPadding(), ) { Row(modifier = modifier .fillMaxWidth() .padding(8.dp) ) { Text(text = "Cancel", modifier = Modifier.clickable { notification.value = "Cancelled" }) Text(text = "Save", modifier = Modifier.clickable { notification.value = "Saved" }) } } }