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.
2,902
questions
0
votes
0
answers
6
views
Without creating another Kotlin Class file, I want to update a BasicTextField from other Buttons for a Calculator App
So I have built out the entire UI for a calculator mimicking the default Android Calculator app that comes on my Motorola phone. I'm using the structure of Column{Box{BasicTextField} Column{Rowx5{...
0
votes
1
answer
26
views
Change Background color of SnackBar in LaunchedEffect (Jetpack Compose)
I am trying to pass message from viewModel into my Screen Activity using collect in Android Jetpack compose, where I am trying to show snackbar but for some reason it is not changing background color ...
0
votes
1
answer
22
views
Jetpack Compose: How to add different amount of spacings to different contentTypes in LazyColumn?
I have a LazyColumn that displays numerous views with distinct contentType values, (viewType in the terminology of the RecyclerView).
Let's consider that this is my LazyColumn:
LazyColumn {
items(...
0
votes
1
answer
62
views
App crashes when there is no delay in LaunchedEffect
Why my app crashes when I run this code:
val scrollState = rememberLazyListState(0)
var isLastItemVisible by remember { mutableStateOf(false) }
LaunchedEffect(scrollState) {
while (!...
0
votes
1
answer
21
views
Drag a view inside parent box using Jetpack Compose
I am new to Jetpack compose, Please help me to find a solution to my problem.
I am trying to add a drag view, The drag view using jetpack is successfully implemented, but when I am dragging the view ...
0
votes
1
answer
37
views
MutableStateOf is not being re-initialized in Jetpack Compose
Below is a simple composable function, when I log the pd object it prints the current value of the retained(boolean) field. But after initializing the isChecked variable the value is always !pd....
0
votes
0
answers
20
views
How can I change the area of Ripple effect for IconButton in jetpack compose?
I want to change the area of Ripple effect for IconButton in Jetpack Compose.
IconButton(
onClick = { viewModel.toggleAudio() },
modifier = ...
-1
votes
1
answer
37
views
How to invoke @Composable function from DrawScope in Jetpack Compose?
I draw bar chart. I want to draw at the end of list loading bar with animation(as a separate function) but I cant invoke @Composable function.
Error:
@Composable invocations can only happen from the ...
1
vote
0
answers
10
views
Is it possible to use TtsSpan with compose to change the way texts are pronounced?
I'm currently working on a compose screen that has a list of telephone numbers. I'm wanting the screen reader to read the phone number individually. I know there's a way to do that for the old UI tool ...
0
votes
2
answers
45
views
Cannot use LazyListScope.items with PagingData in Jetpack Compose
I've been following an Udemy course and in their source code there's this code within a Composable function:
LazyColumn(
contentPadding = PaddingValues(SMALL_PADDING),
...
0
votes
1
answer
30
views
Does storing a reference to LazyListState in ViewModel cause memory leak?
I have a LazyColumn and I want to scroll to the top of the list after swipe to refresh. I use Compose's pull refresh for swipe refresh layout. I am storing lazyliststate in my viewModel to scroll to ...
0
votes
0
answers
19
views
How to perform some tasks in the previous item in VerticalPager?
I want to know If I want to perform any task in the previous Item in the Vertical Pager how can I do this?
Like If I want to send some events from the backend when the page is scrolled or in the ...
2
votes
1
answer
110
views
How to display specific number of items?
I want to create a view with charts that can be scrolled left and right (starting from the right). I've already done this using LazyRow and set reverseLayout to true.
val scrollState = ...
0
votes
1
answer
35
views
Compose Navigation screen blinks when navigate to another screen
When i am trying to navigate to another screen by .clickable on modifier i got this. Never faced such problem earlier. This is how i navigate and what i see on screen.
What i show if response from ...
0
votes
1
answer
29
views
How to navigate from one fragment created in one Navigation graph to another fragment situated in another Navigation Graph?
I have created an MainActivity which has a fragment HelloFragment and a Navigation Graph nav_graph.
And I also have another Activity WhyActivity which has a fragment WhyFragment and a Navigation Graph ...
0
votes
1
answer
43
views
How to correctly apply tint to compose Image?
Image(
painter = painterResource(id = paymentCardLogoId),
contentDescription = null,
modifier = Modifier.size(logoSize)
)
So I have a payment card details view and I am trying ...
1
vote
1
answer
49
views
Image offset in Android TV auto-slider (Jetpack Compose)
The first image of the slider works fine, but from the second on it seems so that the images are not centered, and the second one seems to displace the first one, the third one displaces the first and ...
0
votes
1
answer
42
views
How to reduce the number of recompositions for an animatable outlined icon color in Jetpack Compose?
To reduce color animation recompositions, I usually use drawRest in drawBehind, but what if I have an icon?
https://developer.android.com/jetpack/compose/animation/quick-guide#animate-background
I ...
2
votes
2
answers
73
views
What does "composition" exactly mean in jetpack compose
I'm trying to understand the lifecycle of composable in jetpack compose. It is written in the docs:
The lifecycle of a composable is defined by the following events: entering the Composition, getting ...
0
votes
0
answers
21
views
How can I detect keyboard opening and closing in compose multiplatform?
All the answers that i saw related to detecting the Keyboard open and close event are specific to android (using the WindowInsets).
Is there a way to get the keyboard open/close event in the shared ...
0
votes
1
answer
34
views
Since Compose BOM 2023.08.00, instrumented tests are failing, because lazy list changes seem to be leaving old nodes in the hierarchy
Jetpack Compose version: Compose BOM 2023.08.00
Jetpack Compose component(s) used: Foundation, material, animations, livedata, ui-tooling, viewmodel
Kotlin version: 1.9.10
Steps to Reproduce or Code ...
0
votes
0
answers
18
views
Stream audio from Bluetooth to default output on Android?
How do I setup an Android application which streams audio from Bluetooth to the default output?
Basically, I just want to stream any audio coming in from an already connected Bluetooth device to the ...
-1
votes
1
answer
47
views
drawerContent does not exist in my Jetpack Compose
I was looking at a tutorial titled creating a menu or NavigationDrawer, which said to use drawerContent in a scaffold, but I don't have anything called drawerContent in Jetpack Compose and Jetpack ...
1
vote
1
answer
39
views
Password text field Visibility section Not Work in jetpack compose
Why is the icon.Filled.Visibility section of the visibility section not recognized when I use password text filled? Should I add an implementation? Also, the VisibilityOff section is not recognized, ...
0
votes
0
answers
10
views
Click button type previous page next page can I use Paging3?
I want to implement a project that supports offline, but pagination is triggered by buttons, not by sliding to the bottom. How do I use Paging3? Still doesn't work?
I want to implement local paging ...
0
votes
0
answers
25
views
How can this directional fade in be achieved in jetpack compose?
This seems to be 2 Compose views overlaying than 1 being faded out from top left direction. How can directional fading be achieved in jetpack compose?
0
votes
0
answers
26
views
Android JetpackCompose motion layout has content out of bounds
Now my content of the "LazyColumn" does not scroll to the bottom.
I should have 60 (0-59) items visible.
However when my header is open I can only see 50 (cannot scroll more down)
Layout ...
-1
votes
0
answers
41
views
api request is not executed, I use ktor
I'm trying to execute an API request, but nothing is output in the console. Just silence. I have thoughts that I have configured the server incorrectly. Please point it in the right direction.
...
0
votes
1
answer
44
views
How to change StatusBar color in Light and Dark Material 3 Jetpack compose?
I provide my own color to change statusbar color in my app but it don't work in Material 3.
Here is the default Light and Dark colors in Theme.kt file:
private val DarkColorScheme = darkColorScheme(
...
1
vote
1
answer
75
views
How can I draw below canvas as segmented like 0.7 of path in jetpack compose?
I want to animate stroke path but I couldn't find a way to animate as segmented. How can I draw below canvas as segmented like 0.7 of path from starting point in jetpack compose?
Canvas(modifier = ...
0
votes
2
answers
101
views
How to use rememberPagerState in Jetpack Compose?
enter image description here
```val pagerState = rememberPagerState(
initialPage = 0,
initialPageOffsetFraction = 0f
) {
// provide pageCount
}```
What should I ...
0
votes
0
answers
58
views
CameraX - Can not add resource (com.android.aaptcompiler.ParsedResource@1606e948) to table
Execution failed for task ':app:mergeRegularRockDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable
> Resource ...
0
votes
1
answer
27
views
Prevent Popup from adding padding in a column with `Arrangement.spacedBy(LARGE_PADDING)`
So I have a Column with a Header, Body and Footer. When I replaced a Dialog in the footer with a Popup, it also applies the padding from the Arrangement to the PopupMenu. Which it did not do for the ...
0
votes
0
answers
44
views
Unexpected behavior of Jetpack Compose Modifier.animateContentSize() animation and State
I just started experimenting with Jetpack Compose animations. The code I'm working with is part of this Jetpack Compose codelab. The complete code is available on this Github page.
This is the UI of ...
0
votes
0
answers
34
views
How to measure first frame of Android Jetpack Compose view?
We're aimed to build performance monitoring in our compose page. One of these monitorings is to measure how long we'll reach the first frame from app boot. For example, we used LazyColumn in our ...
0
votes
1
answer
36
views
The delete function deletes all elements of the collection in Firestore Database
In the application I'm working on, the user has the option of entering their own data into Firestore. After that, this data is uploaded to AccountScreen in the form of an image and title. I am trying ...
1
vote
1
answer
33
views
Positioning elements in jetpack compose
The user has the option of entering his own data in Firestore. After that, the data is retrieved from the database in ImageCard. Each time the user adds new data, a new ImageCard is added. I would ...
0
votes
0
answers
12
views
Multiple @PreviewParameters not allowed (Jetpack)
I need to use the @Preview annotation with my @Compostable class, which takes two arguments in its constructor.
So I set up two PreviewParameterProviders and added the @PreviewParameter annotation ...
0
votes
0
answers
18
views
How to Implement Glassmorphism Effect like in IOS in android using Jetpack Compose [duplicate]
In jetpack compose there's no solid way to achieve Glassmorphic design. Blur View library is there but for it's for the View,
Hack or Way to get achieve Glassmorphic design effect in jetpack compose ...
0
votes
1
answer
46
views
Why does composable call twice during passing data between two screen
I have an Issue while passing data between two screen. Currently log called twice from below code
composable(Screens.VisionBoardNameChooserScreen.route) {
userViewModel....
0
votes
2
answers
75
views
Is there any way to add weight in lazyRow or lazyColumn in compose items
I tried this but weight is not working here.
Is there any way to add weight I want to create a number pad from 1 to 9.
For this I want to add 1 lazy row with fillMaxWidth and add 3 items with 1 weight ...
0
votes
1
answer
108
views
Full Screen Layout For Image View In Compose Without Status And Navigation Bar
I want to view the content or image in full screen by hiding the navigation and status bars as we seen on google photos when the image is clicked on preview it goes to full screen. I used WindowCompat....
0
votes
1
answer
95
views
Restrict only numbers, commas(,) or only one dot(.) using Regex for TextField Jetpack compose
I am working on customizing TextField in Jetpack Compose, I want restrict the input from the user to numbers, commas or a single dot.
The regular expression that I am currently using is val ...
1
vote
1
answer
46
views
Tapping on DropDownMenu causes the keyboard to show up
I've recently update Jetpack Compose to version 1.5.0. I have this piece of code which handles a drop down menu:
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun <T> DropDownMenu(
...
0
votes
1
answer
34
views
How to handle `Crossfade` only for some states in Compose?
In Android Compose UI, I'm using Crossfade animation to transition between my Composables. The problem is I don't want to have the Crossfade for Composable Intro to Comopsable Loading, but for the ...
1
vote
1
answer
173
views
Jetpack Compose infinite loop after first render on button press
I was trying some unusual things with compose while trying to read and understand the documentation with my friend. We have written a code in compose such as:
@Composable
fun MyComponent() {
var ...
0
votes
2
answers
84
views
How to access the Key of an item in lazyColumn or lazyRow?
I am using Jetpack Compose to create a LazyColumn as shown below. My lazy list has two differnt view types, for each food in the list, it displays a food name (first type) and a couple of food ...
0
votes
2
answers
184
views
Initial loading of a video file in Media3 ExoPlayer takes too long
I have a local HTTP server where I'm hosting an MP4 file (about 50MB). I set up the following Composable in my app:
@Composable
private fun VideoItem(
url: String,
modifier: Modifier = ...
1
vote
0
answers
10
views
Jetpack JavaScriptSandbox blocks forever
I am trying to run js code asynchronously using the Jetpack JavaScriptSandbox library, and it the docs it says to run JavaScriptSandbox.createConnectedInstanceAsync(context).get().
The first part ...
1
vote
2
answers
119
views
The click event of jetpack compose version 1.5.0 fails
Problem Description:
When I upgraded Compose BOM to version 20230800, clickable occasionally did not take effect. When I rolled back to version 20230601, it worked fine again.
Compose: platform('...