Issue Using Jetpack Compose state management, I want to change background of Card in scrollable list, when user clicks on AlertDialog As shown in below code, I have stored state as cardState with remember When user is clicking on AlertDialog
Continue readingTag: android-jetpack
Why don't Indication work for Button or Icons?
Issue As solved here, I disable the tap flashing by setting the indication to null. However, this is not working for Button or Icons?! Solution In the Button you can’t use the indication=null in the clickable modifier since it is
Continue readingCan we or should use Preview compose function for main widget as well?
Issue Like below are two functions @Composable private fun WaterCounter(modifier: Modifier = Modifier) { val count = 0 Text( text = "You’ve had $count glasses of water", modifier = modifier.padding(all = 16.dp) ) } @Preview(showBackground = true) @Composable private fun
Continue readingHow to get instance in Kotlin with Context.getSystemService(Class)
Issue In Google Android Kotlin documentation, Every now and then there is a below line present in android documentation that: Instances of this class must be obtained using Context.getSystemService(Class) For example: Instances of this class must be obtained using Context.getSystemService(Class)
Continue readingUnable to call @Composable function from remember block
Issue I want to calculate height of Box in a function and I want compose to remember its result and not call that function again. That function has some composable content and therefore it is a @Composable function. The problem
Continue readingHow to change start destination of a navigation graph programmatically?
Issue Basically, I have the following navigation graph: I want to change my starting point in navigation graph to fragment 2 right after reaching it (in order to prevent going back to fragment 1 when pressing back button – like
Continue readingDefault value for dropdown menu in jetpack compose
Issue I want to select a default value for my dropdown menu as soon as the component renders. Don’t want it to set as a label instead I want one of the options from dropdown menu to be selected by
Continue readingHow to access Context to create a file directory in Jetpack Compose?
Issue I am using this createDir() function to create directories but to call it from Composable functions I need to take function outside of MainActivity unfortunately because of applicationContext it does not work. class MainActivity : ComponentActivity() { fun createDir()
Continue readingHow to change passed-in modifier before using it?
Issue I’m trying to add some conditional logic to the modifier parameter in my custom composable before using it. How can this be done? For example @Composable fun MyComposable(index: Int, myModifier: Modifier = Modifier) { if (index == 0) {
Continue readingNavigation Component: how to navigate from activity to a fragment
Issue I want to navigate on click FAB in (activity) to New fragment 1. in my code fab button in the main activity common for all pages. could anyone guide me? activity.xml <?xml version="1.0" encoding="utf-8"?> <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
Continue reading