Vivek Sharma
03/04/2021, 8:01 PMTextField
inside Dialog
, when I close the dialog , app crashes saying
java.lang.ArrayIndexOutOfBoundsException: length=5120; index=-2
at androidx.compose.runtime.SlotTableKt.groupSize(SlotTable.kt:2558)
at androidx.compose.runtime.SlotTableKt.access$groupSize(SlotTable.kt:1)
at androidx.compose.runtime.SlotReader.groupSize(SlotTable.kt:596)
at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2215)
at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2499)
at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:2625)
at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:406)
at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:724)
Timo Drick
03/05/2021, 7:48 AMSe7eN
03/05/2021, 9:12 AMTimo Drick
03/05/2021, 9:47 AMVivek Sharma
03/05/2021, 12:16 PMMBegemot
03/10/2021, 6:03 PMTimo Drick
03/11/2021, 11:36 AM@Composable
fun SetTimerDialog(currentSeconds: Int, newSecondsSet: (seconds: Int?) -> Unit) {
var textValue by remember { mutableStateOf(currentSeconds.toString()) }
Box(Modifier.fillMaxSize().zIndex(10f).background(Color.Black.copy(alpha = 0.75f)), contentAlignment = Alignment.Center) {
Surface(shape = MaterialTheme.shapes.medium) {
Column(Modifier.padding(16.dp)) {
Text("Set count down in seconds.", Modifier.padding(bottom = 4.dp))
TextField(
value = textValue,
onValueChange = { textValue = it },
keyboardOptions = KeyboardOptions(
autoCorrect = false,
keyboardType = KeyboardType.Number,
imeAction = ImeAction.Done
),
keyboardActions = KeyboardActions(onAny = { newSecondsSet(textValue.toInt()) })
)
}
}
}
}