Questions tagged [android-jetpack]

Android Jetpack is a Google's set of libraries, tools and architectural guidance to build Android apps and provides common infrastructure code.

Android Jetpack is the next generation of Android components, bringing together the benefits of the Support Library -- backwards compatibility and immediate updates -- to a larger set of components, making it quick and easy to build robust, high quality apps.

It manages activities like background tasks, navigation, and lifecycle management, so you can eliminate boilerplate code and focus on what makes your app great.

It is designed to work well with Kotlin, saving you even more code with Android KTX. The new Android Jetpack components released today include WorkManager, Paging, Navigation, and Slices.

Useful Links

2879 questions
1
vote
1 answer

Avoid duplicate call in LaunchEffect with multiple key in jetpack compose

I want to avoid multiple function call when LaunchEffect key triggers. LaunchedEffect(key1 = isEnableState, key2 = viewModel.uiState) { viewModel.scanState(bluetoothAdapter) } when first composition isEnableState and viewModel.uiState both…
Kotlin Learner
  • 3,995
  • 6
  • 47
  • 127
1
vote
1 answer

Avoid Recomposition in nested column in jetpack compose

I am working on nested column in jetpack compose. I have one list which is huge amount of data coming from server. I was checked in Layout Inspector and I see that whenever my item is added in list it recompose and increase counts. So my doubt is if…
1
vote
2 answers

Jetpack compose: Scaffold navigationBarsPadding not working properly

I'm using Jetpack compose with Scaffold. As you can see it doesn't work properly. Scaffold( modifier = Modifier .fillMaxSize() .navigationBarsPadding(), ) { ... } Note that I have called…
1
vote
1 answer

verticalArrangement = Arrangement.Bottom for Column not working

I have a Jetpack Compose composable in a column beginning with a icon, title, textbody and a pager row: Box(modifier = Modifier .fillMaxSize() .background(color = TVTheme.colors.blue) ) { val bigPadding = 334.dp val smallPadding = 24.dp …
1
vote
1 answer

How to make transparent background in Box jetpack compose

I want to make transparent color of Box in jetpack compose. I tried but it makes white background. Can someone guide me on this? @Composable fun OnContentLoading() { Box( modifier = Modifier .fillMaxSize() …
Kotlin Learner
  • 3,995
  • 6
  • 47
  • 127
1
vote
1 answer

Create Common Edit Text-field in Jet-pack Compose

I am new in jetpack compos. Can anyone tell me It's Right to Create Common Composeble Function? Common Function @Composable fun commonTextFiled( hint: String, icon: ImageVector, keyboardType: KeyboardType = KeyboardType.Text, …
1
vote
0 answers

Avoid recompositions of other elements when changing TextField value

I have basic Login screen in my app, which looks like this: LoginScreen.kt: @Composable fun LoginScreen(navController: NavController, viewModel: LoginViewModel) { val userEmail = viewModel.userEmail.collectAsState() val userPassword =…
1
vote
1 answer

onTap - detectTapGestures not working properly as clickable(s) with same code and state hoisting

I have a method 'activity' which hosts a 'screen' and since state hoisting is cool, I did just that but with a problem. While the code works perfectly (incrementing the value) using Modifier.clickable, the same code does not properly work using …
Kinyo356
  • 135
  • 13
1
vote
2 answers

Jetpack Compose Horizontal Pager Swipe Delay

I have a Jetpack Compose App that uses a Horizontal Pager. The behavior I am seeing is that when I swipe to my next page it moves smooth, but when I swipe back the screen advances about 3/4 of the way and pauses and then if I wait it completes the…
LilMoke
  • 3,176
  • 7
  • 48
  • 88
1
vote
0 answers

Handle drag gesture entering composeable bounds

I have a (non-lazy) column of text buttons (say, they contain the letters A-Z). I have on-click modifiers applied on each of these buttons that perform an action corresponding to the button clicked. I would like to perform these same actions when…
1
vote
1 answer

Using LazyHorizontalGrid inside LazyColumn

I try to use LazyHorizontalGrid with 2 fixed rows inside a LazyColumn. But then app crashes: IllegalArgumentException: LazyHorizontalGrid's height should be bound by parent This is surprising, as I can use LazyRow inside a LazyColumn without any…
1
vote
0 answers

compose BlendMode Compatibility issues

I want a Black and white mode Surface(color = MaterialTheme.colors.background,) {        MainPage()//Text Image    Canvas(modifier = Modifier.fillMaxSize()){        drawRect(            color = Color.White,            blendMode =…
kakaxi-zh
  • 13
  • 3
1
vote
1 answer

Dialog in Jetpack Compose

I am new in Jetpack Compose. I just implemented an AlertDialog in Jetpack Compose. I'am not clear about Dialog show and dismiss process. Here is sample code: @Composable fun CreateAlertDialog() { Column { val openDialog = remember {…
1
vote
1 answer

How can I obtain from which Main Route I came from when using Nested Navigation in Jetpack Compose (NavHost)

I'm using the AnimatedNavHost component in my Jetpack Compose app to manage navigation between different composable routes. I have added multiple navigation blocks to the AnimatedNavHost, and I want to obtain the route (it came from) of a specific…
1
vote
1 answer

How to set Box(contentAlignment=CenterVertically40%DownThePage)? Need advanced alignment option for Box

I'm building this screeen from the Android Jetpack Compose lessons, and I want to somewhat-center-vertically the middle / 'Full Name' red box -- but I don't want it fully centered (i.e. 50% down the page), I want it 40% down the page, but the…