skip to Main Content

Android Studio – Difference between build.gradle.kts and libs.versions.toml

What's the difference between build.gradle.kts and libs.versions.toml? When should each be used? build.gradle.kts (:app) plugins { alias(libs.plugins.android.application) alias(libs.plugins.jetbrains.kotlin.android) } android { namespace = "com.companyname.myapplication" compileSdk = 34 defaultConfig { applicationId = "com.companyname.myapplication" minSdk = 33 targetSdk = 34 versionCode =…

VIEW QUESTION

Android Studio – TextField 'OnValueChange' called twice without entering any input

fun TextFieldWithIconsAndErrorLabel( text: String, charLimit: Int = Int.MAX_VALUE, keyboardType: KeyboardType = KeyboardType.Text, onValueChange: (String) -> Unit, ) { val keyboardController = LocalSoftwareKeyboardController.current var shouldShowMaxCharLimitError by remember { mutableStateOf(false) } BasicTextField( modifier = Modifier .fillMaxWidth(), value = text, onValueChange = {…

VIEW QUESTION

Android Studio – how to pass viewModel as parameter in NavHost compose navigation

I have to following NavHost: NavHost( navController = navController, startDestination = Destinations.ComposeEntryPointRoute ) { composable<Destinations.HomeRoute> { HomeContent() } composable<Destinations.GradeConverterRoute> { GradeConverterScreen(navController = navController, gradeConverterViewModel = DONT KNOW WHAT TO DO HERE) } } I don't know how to pass the…

VIEW QUESTION

Android Studio – pass method to Composable as parameter inside clickable lambda. The expression is unused

I have the following Composable @Composable fun ClickableBar(text: String, action: () -> Unit) { Row( modifier = Modifier .height(40.dp) .background(color = AppPrimaryGreen) .fillMaxWidth() .clickable { action }, verticalAlignment = Alignment.CenterVertically ) { Text(text = text) Icon( painter = painterResource(R.drawable.icon_arrow_right), contentDescription…

VIEW QUESTION
Back To Top
Search