Questions tagged [android-jetpack-compose]

Jetpack Compose is Android’s modern toolkit for building native declarative UI made by Google. If you're targeting desktop with Compose for Desktop, use both this and [compose-desktop] tags.

android-jetpack-compose
Filter by
Sorted by
Tagged with
0 votes
0 answers
36 views

Android: intercept back navigation with a gesture in Jetpack Compose

I want to intercept back navigation gestures in my Android app. Found this as a suggestion, but it doesn't get invoked, no matter where I place it in the Composables hierarchy: BackHandler(enabled = ...
Vasiliy's user avatar
  • 16.4k
0 votes
1 answer
20 views

Glance widget lottie

I am wondering how to implement lottie file on glance widget, using json lottie from raw folder. How can I do this? I checked the Glance widget documentation and tried do this the same as in a normal ...
Mateusz Augustyniak's user avatar
0 votes
1 answer
44 views

drawing a curved custom line in compose

I am new to Android Development and am trying to draw a custom curved line in compose. I am able to draw a straight line but the curved line is not coming as expected. i have stored the node data as : ...
Sathvik's user avatar
0 votes
0 answers
17 views

Why TextField in jetpack compose is causing unnecessary recompositions?

I'm attempting to utilize TextFields in my Jetpack Compose project. Instead of individually coding each TextField, I opted to employ forEach{} on a list of TextField data to generate them dynamically. ...
CODAR747's user avatar
0 votes
1 answer
21 views

Passing value to padding in compose BOX function does not effecting the output

I am new at Android Development. I have recently started Android Development course from Google Developer site. i am making an app for a birthday wish but problem occurred that is i am passing value ...
Prabhat Tripathi's user avatar
3 votes
2 answers
616 views

Jetpack Compose navigation in Android: combine bottom tabs with multi backstack and back button

I implemented bottom tabs with multi backstack in my app using this code: NavigationBar { bottomTabs.forEachIndexed { _, bottomTab -> NavigationBarItem( ...
Vasiliy's user avatar
  • 16.4k
-1 votes
1 answer
24 views

Jetpack Compose: AnimateAsFloat not working

I want to animate/translate my ImageView only once and for that I have written this code: @Composable fun SunsetBox(panchangData: Data?, targetProgress: Float) { Box( modifier = Modifier ....
Gaurav Arora's user avatar
  • 8,342
0 votes
1 answer
60 views

Jetpack Compose: How to Get Build/Debug Config Info

I am looking to display VERSION_NAME etc in the app. However, Traditional ways don't work. BuildConfig isn't resolved. Maybe it needs to be imported?! I tried to find a solution by web searching but ...
A Farmanbar's user avatar
  • 4,576
0 votes
1 answer
26 views

Compose theme inconsistent behavior

I have a theme in my app set up like so: //use light colors for dark mode private val ConceptualSystemsDarkColorScheme = darkColorScheme( primary = Yellowish, secondary = YellowishBright, ...
moonlightcheese's user avatar
0 votes
0 answers
84 views

Android Compose AnchoredDraggable - Listen for Completed Drag

I'm using Compose's AnchoredDraggable to drag some items vertically, and I want to invoke a callback each time one reaches the end anchor (specifically the end anchor - I don't want to listen for when ...
pjp94's user avatar
  • 45
0 votes
1 answer
30 views

List not scrolling completely when last item is an image in compose

I am building a chat feature and when opening the list of messages, the last message of the conversation is displayed at the bottom without any problem. But, when the last message is an image, it does ...
William St-Laurent's user avatar
1 vote
0 answers
44 views

Media 3 Exoplayer Lifecycle change bug on Jetpack Compose

I set up Exoplayer with classic way. val exoPlayer = ExoPlayer.Builder(context).build() exoPlayer.repeatMode = Player.REPEAT_MODE_ONE exoPlayer.playWhenReady = false exoPlayer.setMediaItem(MediaItem....
sss sss's user avatar
  • 194
0 votes
1 answer
16 views

Execute Random Number Generation Once In Kotlin With Jetpack Compose

I am trying to add a random Int to another Int once for math purposes, but it seems to get new random numbers frequently instead of once. I pull an Int from an Array with a value of 45, and I want to ...
The Quackiest's user avatar
0 votes
0 answers
31 views

how can i do a Line Chart with drag gesture in kotlin jetpack compose?

I have a kotlin file to display a composable chart(using YCharts library) but im stuck trying to do a drag gesture. I already tryied to do a Modfier.draggable() and nothing happens. follow the code ...
pllsatierf's user avatar
0 votes
0 answers
19 views

dynamicDarkColorScheme always reports the same primary color no matter the wallpaper

I'm seeing some behavior I don't understand on my Galaxy S23 running Android 14. In my JetPack Compose app, dynamicDarkColorTheme always reports the same color no matter the selection of wallpaper or ...
Mike Ward's user avatar
  • 3,261
0 votes
1 answer
37 views

neither my Design view nor any Android Virtual Devices Will Display anything

I am in the process of taking the Android Basics with Compose course on the Android developers' site. I've hit a speed bump the last ten days or so: whenever I try to open the split design view (or ...
OES's user avatar
  • 1
0 votes
0 answers
10 views

Why are the constructors of CardColors, TopAppBarColors, etc internal? In my other Project its not

The question is above Is it because of different dependencies in the projects. I post my dependencies of the current project below: dependencies { // Retrofit implementation("com.squareup....
Luca Christ's user avatar
1 vote
1 answer
37 views

How to use a viewmodel to trigger a mutablestate?

I want to use a boolean variable that is in my viewmodel to trigger a composable in my activity class. It should recompose whenever that variable changes. class TestViewModel: ViewModel() { var ...
user21966091's user avatar
1 vote
2 answers
83 views

Injecting Context from Android into SqlDelight Driver using koin within KMP

I have a Kotlin Multi-platform project, that has iOS, Android and Desktop in it, and I wanted to use SqlDelight to store data. however I'm using Koin as a DI. Since I have several platforms, I made ...
Saher Al-Sous's user avatar
0 votes
1 answer
15 views

Why use Modifier instead of modifier

enter image description here I don't kow why....... Why can’t we directly pass the function’s parameters to the place marked by the red line? if we use "modifier", the column will lose the &...
Gao Zihan's user avatar
0 votes
1 answer
13 views

Kotlin 2D Array of Strings Inference Type Error Using indexOf

I am trying to use a set 2D array to pull data. I am trying to find the Index of a String object in an array, and use that Index to pull data from the same row but separate column so I don't have a ...
The Quackiest's user avatar
0 votes
0 answers
23 views

Selecting one row on Room Database Android Compose

I have this model data class MomentDate( @PrimaryKey var id: String, val momentId: String, val date: Date, val note: String ) then I want to query one row like this: @Query(&...
Harya Kumuda's user avatar
0 votes
1 answer
34 views

How to create a thumbstick with Kotlin Android Compose

What I currently have is app/src/main/java/io/github/kitswas/virtualgamepadmobile/ui/composables/Circle.kt package io.github.kitswas.virtualgamepadmobile.ui.composables import androidx.compose....
Kitswas's user avatar
  • 1,167
1 vote
1 answer
68 views

Fleet couldn't auto-reload changes from build files Error

in Linux (Debian 12.5) i installed Jetbrains Fleet, and downloaded a project compose android from kmp.jetbrains.com, when i open the project from fleet and enable smart mode, it takes some times ...
HishamKanon's user avatar
1 vote
1 answer
39 views

Jetpack Compose Scaffold-content doesn't start below TopAppBar

My onCreate-method looks this way: setContent { CaesarCipherTheme { Surface( modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background ) { Scaffold( ...
cluster1's user avatar
  • 5,184
1 vote
1 answer
26 views

combining multiple mutablestates

just started picking up Compose MP and have been running into difficulty combining 2 sources of mutablestates to a new mutablestate or flow within a viewmodel. per documentation, I figured ...
Shay_A's user avatar
  • 29
0 votes
0 answers
20 views

How to clear the drawing for stylus low latency?

Android has support for stylus low latency. The example app is here: https://developer.android.com/codelabs/large-screens/advanced-stylus-support#5 I want to have a button to clear the drawing screen ...
Sean Nguyen's user avatar
  • 12.8k
0 votes
0 answers
28 views

android-pdf-viewer Received status code 401 from server: Unauthorized

I'm trying to implement the AndroidPDFViewer in a JeckPack Compouse Android app. I get this error "Received status code 401 from server: Unauthorized". I already added to the settings.gradle....
DrGio's user avatar
  • 11
0 votes
1 answer
45 views

Inject a class into a composable function using hilt

I figured out I don't really need my viewmodels to be lifecycle aware and I want to replace them with just plane kotlin classes to handle the ui logic, my problem is hilt; since it will only allow me ...
mohamed shawky's user avatar
0 votes
0 answers
35 views

preventing duplicate text

I'm using Composables in Android Studio Kotlin, It creates a spanned string via specified keywords via looking up within foreach loop, How to make it append just one time or remove duplicated appended ...
Sajjad Yousefnia's user avatar
0 votes
0 answers
40 views

Jetpack compose - how I can hookup LiveData property from ViewModel with TextField in activity?

I'd like to display a rationale, where user can be navigated to the settings on accept, or asked for a city name when declined. I've tried to make there two functions. One, 'displayRationale', and ...
katowicenocom's user avatar
-2 votes
0 answers
23 views

MarkerInfoWindow doesn't hold the clicked marker position after list refresh in Compose Map

I am using com.google.maps.android:maps-compose:4.3.3 to show map with markers. There are not so much of them, so I don't use clustering. I have a mutableStateList of markers which fetches data ...
Sergiy Skyrda's user avatar
0 votes
0 answers
17 views

How do you import functions from one page to another in Jetpack Compose?

I'm trying to make an increment counter application in Jetpack Compose. I've divided each widget across separate files. I have the text widget that displays the number on one file, the button that ...
John Brown's user avatar
0 votes
1 answer
34 views

Jetpack compose ViewModels - should I have one ViewModel for different api calls?

Currently, I'm trying to get down basics of jetpack compose, and I'd like to ask you about the view model. Let's say we have an app which will make a few different api calls. As far as I know, before ...
SmierdzoncaRobotaEhhh's user avatar
0 votes
1 answer
26 views

Change background color of clicked sentence in Text

I want to implement a feature where when I click on a specific sentence within this paragraph, the background color of that sentence changes. I've tried looking into gesture detection and text ...
Kursat's user avatar
  • 21
0 votes
0 answers
27 views

Made a widget with glance API in Jetpack Compose. Button filling the whole widget

I used the Glance API in Jetpack Compose to make a homescreen widget. However, when used, the button fills up the whole widget. Did as mentioned in this documentation - https://developer.android.com/...
Raghavendra Hande's user avatar
0 votes
1 answer
43 views

Jetpack Compose how to reverse edge-to-edge when leaving composition

I want to achieve an edge-to-edge screen (only for a specific screen in the app) and I am using ComponentActivity enableEdgeToEdge() method. I want to restore the previous setting when navigating out ...
rysv's user avatar
  • 2,890
3 votes
0 answers
53 views

PullRefreshIndicator circle always displaying on jetpack compose

A blank grey circle of PullToRefreshContainer is always displaying even first time or after refreshing. Here is my code val pullRefreshState = rememberPullToRefreshState() Box( modifier = ...
Binh Ho's user avatar
  • 4,397
1 vote
0 answers
30 views

Android Studio Using recently added resources in compose preview in multi-module project

I started making apps using multiple modules, and ever since I keep having problems with resources. Whenether I add a new resource (string, drawable, font...) and try to use it in a Compose Preview, I ...
Damon's user avatar
  • 75
4 votes
2 answers
126 views

Android compose animations crashing in release builds

The app crashes anytime I interact with just about any compose control. Just the release, the debug works fine. The error says: androidx.compose.ui.R$id is missing hide_in_inspector_tag The ...
johngray1965's user avatar
1 vote
0 answers
21 views

Background location using WorkManager in Android 13 returns null when app is closed

Manifest file : <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <uses-permission ...
SasidharanIOS's user avatar
0 votes
0 answers
30 views

How does Jetpack Compose know that a modifier affects only e.g. the drawing phase?

The Compose documentation e.g. here mentions, that Modifier.drawBehind only affects the drawing phase, other phases are not re-executed when this modifier changes. But how does Jetpack Compose know ...
me.at.coding's user avatar
  • 16.3k
0 votes
1 answer
68 views

Error on Google Sign In CredentialManager, using Jetpack Compose

I am trying to create a Sign In with Google Button but everytime credentialManager.getCredential is called, it gives me : androidx.credentials.exceptions.NoCredentialException: During begin sign in, ...
Derwin Oesmanto's user avatar
0 votes
1 answer
23 views

How to detect 2 drag gestures independently in Jetpack Compose?

I want to create a game for 2 people, where each person has to control a plane by dragging his finger. But I don't see any methods in Compose to detect the second drag. The onDragStart method is not ...
Alyona's user avatar
  • 47
0 votes
0 answers
42 views

ViewModel property is empty even after initializing it

I have a program, where user is being asked for granting location permissions, location service. After that, in the ViewModel user current geo location should be saved in MutableLiveData. In other ...
StuckedForeva's user avatar
0 votes
0 answers
30 views

`collectAsState` doesn't collect the latest value when emitted from the viewModel

Resource definition for reference sealed class Resource<T>(open val data: T?) { class Success<T>(override val data: T) : Resource<T>(data) class Failure<T>(val message: ...
Sbeve's user avatar
  • 101
0 votes
1 answer
39 views

Problem using HorizontalPager in Jetpack Compose

Good night for everyone! In my app, I'm doing a Horizontal Pager, and the following happens: When I use when inside pageContent, the pages are rendered normally. Code and screenshot are below Scaffold ...
joaoAvila's user avatar
1 vote
1 answer
48 views

OutlinedTextField placeholder, not changing color in Jetpack Compose

I've been trying to get the placeholder text inside of an OutlinedTextField to change color and it is just staying black, no matter what I do. I am using M3 theme and components. I can get everything ...
Neglected Sanity's user avatar
0 votes
0 answers
19 views

How to make text depending on my image height

I've got this item inside a LazyColumn but I can't seem to be able to make the blue column have the same height than my icon. The second text is optional. I have the following code Row( ...
Biscuit's user avatar
  • 4,970
0 votes
0 answers
17 views

Navigation destination is being called 4 times for some reason in jetpack compose?

This is my NavGraph, here the destination "VerificationScreen/{verificationId}" is being called 4 times thus creating the viewmodel 4 times. What could be reason for this? @Composable fun ...
skinnyhrit's user avatar

1
3 4
5
6 7
251