58 questions
1
vote
1
answer
331
views
How do I make my navigation bar transparent with Material3 Expressive and Navigation3?
I'm trying to obtain a transparent navigation bar within my app. Some Android apps have this feature, where the content slides below the navigation buttons (which are on a transparent surface), and it ...
1
vote
1
answer
1k
views
Gradle: Could not create an instance of type org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget
Please help me fix this issue.I recently updated the latest versions of Flutter, Dart, Java, and Android Studio. I have been encountering problems when trying to Flutter run my project. The errors are ...
0
votes
0
answers
54
views
How do I call a KCallable in Kotlin Android passing the receiver and arguments?
I have tried the answer in this post but I still get the error in my Kotlin Android project.
Here is how my code looks like:
interface BaseServiceScope {
suspend fun resolveState2(intent: Intent?)...
1
vote
0
answers
166
views
DPAD events handling with Jetpack Compose when Talkback is ON (Media 3 exoplayer)
I am using ExoPlayer (Media3) in Android TV with compose, a streaming application, but when Accessibility/Talkback is ON, DPAD events are not being captured at client side, only back/Enter/Center ...
0
votes
1
answer
60
views
Android: Linear Layout: Setting text view value from code
I have a bunch of text views in a linear layout. The user's interaction with them is view-only: If the user guesses correctly (using voice), that guess will show in one of the text views. It looks ...
1
vote
0
answers
26
views
UI freezes after showing toast after handling illegal exception in main Application
I was trying to implement a centralized error capturing and showing the user a Toast message (app was crashing). I have since moved on and just doing try catch for each case but I couldn't figure out ...
0
votes
1
answer
36
views
POST API response triggering onFailure in Android client despite working in Postman
In a recent project, I developed an Android client using Kotlin and Retrofit to communicate with a microservice built with Spring Boot, which connects to an MS SQL Server database via JDBC. The client ...
0
votes
1
answer
37
views
propagating errors from query flow to out
I admit...the design have issues but looking for a quick solution for now. I have this code
try {
val query = query goes here
val queryFlow =
query
.queryChangeFlow(...
0
votes
1
answer
53
views
viewmodel is being set between screen navigations with composable
I have a small cart system. I want to maintain items added to the cart and for the person they are added for across screens.
But by the time i reach screen2, the viewmodel resets.
@HiltViewModel
class ...
0
votes
2
answers
1k
views
How to force recomposition of composable in Jetpack Compose? Change color button
I'm new in Android development. Currently I'm trying to do a true or false quizz app. Its main screen presents a sentence and two buttons, True and False, which are white at first. Just one button can ...
1
vote
1
answer
81
views
RecyclerView item selection not working as expected when minimizing and maximizing app
After minimizing my app and coming back to my app again to select item from recycler view then the imageview checkbox and color filter that marks recyclerview item as checked disappear but when I ...
1
vote
0
answers
740
views
WiFi Direct Hotspot Connection (KOTLIN/ANDROID)
I Create a Simple APP in Kotlin, when 1 device Click a button, Button goes to Create a Group of WiFi Direct, Its means WiFi Direct Hotspot and we can see it in WiFi list of any Device like below Code (...
1
vote
1
answer
371
views
8 issues when i create a basic view project kotlin on the android studio
`8 issues were found when checking AAR metadata:
Dependency 'androidx.navigation:navigation-fragment:2.7.1' requires libraries and applications that
depend on it to compile against version 34 or ...
3
votes
1
answer
203
views
How to create a two colour striped Drawable programmatically?
Similar to this question asked over 10 years ago:
banded background with two colors?
I need to create a drawable to be the background of a generic view that has two distinct rectangular striped colors,...
0
votes
1
answer
60
views
NullPointerException while retrieving data from room
I have 3 entitites (Location, Current and Forecast) with following relationships:
1.) Location - Current (one-one)
2.) Location - Forecast (one-one)
Now to retrieve data from it i wrote a query
@...
1
vote
1
answer
888
views
Custom Overflow Menu Of Toolbar Android
I am trying to implement a custom overflow menu in a toolbar, the image is attached for reference. I went through many tutorials and articles to implement the desired result but was unable to do it. I ...
0
votes
1
answer
335
views
How to load files on startup using a saved URI string in Android?
I tried to load images from a directory using Intent.ACTION_OPEN_DOCUMENT_TREE and it worked fine until I tried to save the URI I got to preferences. Then I could read it but there were no files in ...
0
votes
0
answers
345
views
Create callBack with hilt - android kotlin
I write a callback with hilt and it good work when I test it just for call. But when I use like bellow get me *throw catch*:
My Interface is:
interface ButtonCallback {
fun onButtonClick()
}
And ...
-1
votes
1
answer
241
views
What to pass in as type handler for Bluetooth class for data transfer?
I am working on an Android app to communicate wirelessly with an Arduino over Bluetooth with an HC-05. I have been following the Transfer Bluetooth data documentation from Android. The following code ...
0
votes
1
answer
152
views
How to get bluetoothClass.Device for tablet?
In my app I am checking the discovered bluetooth devices type by Class bluetoothClass.Device
I want to check if device is tablet or not but I can not find anything to check is device tablet or not.
I ...
6
votes
0
answers
539
views
App Open Ad is showing app content in place of advertisement
My app was getting too high CTR for AppOpenAd which was around 35%-40%. So after looking for the issue I found that the AppOpen Ad is displaying the AppContent background in place of the advertisement....
5
votes
1
answer
911
views
Compose android tests fail when minify enabled, class / methods not found
My Compose unit tests fail if I have minify enabled on my app.
java.lang.NoSuchMethodError: No interface method complete()Z in class Lkotlinx/coroutines/CompletableJob; or its super classes (...
0
votes
0
answers
62
views
Android Studio Kotlin: Why my Button continually causes crashes when I clicked it
i am making a voice recorder activity, but when i press the button to play the recorded voice it give me a message "unable to play the audio file: /storage/emulated//0/recorded_audio.mp3: open...&...
11
votes
1
answer
7k
views
how to make two circles with jetpack compose
I want to make this shape with jetpack compose how can I do it?
0
votes
0
answers
329
views
How play(), pause(), stop() functions work while using rive with Android Development in kotlin
I am trying to add a progress bar from rive to my android with kotlin, but when every i use play(), pause(), stop() methods, app crash.
Can anyone plz, explain how to solve this and i have seen there ...
4
votes
1
answer
794
views
What does the single exclamation "!" mean after the type in Kotlin?
I'm learning to Develop Android Apps using Kotlin. I previously used to Develop using Java. While coding in Android Studio, I can see that the return types, parameters, etc. used in the Lambdas, ...
0
votes
1
answer
569
views
Two Way Binding on Double Android
I read a few posts to convert from String to Integer and tried to do the same to convert string to double using two-way binding but was unable to do it.
SampleViewModel.kt
class SampleViewModel: ...
1
vote
2
answers
602
views
How can I securely store data on Android that will survive a reinstall?
Looking at older posts here on Stack Overflow, it appears this is not possible. But I'm wondering if there are any newer SDK APIs that support this ability?
In my specific case, I need to create a ...
0
votes
4
answers
2k
views
Smart cast to 'Type!' is impossible, because 'variable' is a mutable property that could have been changed by this time
I would really appreciate if someone will help me.
I'm trying to make an app using kotlin for android and am running into problems because I get errors like "Smart cast to 'Button!' is ...
0
votes
1
answer
922
views
Hoping to display a value every 3 seconds using thread.sleep. However, it's not working
im taking this kotlin basics in google and im in the "intro to debugging" section.. total noob here and i've managed to plow through the subjects and now im stuck here..
so the expected ...
0
votes
0
answers
350
views
How to show dynamic date as Header in the RecyclerView?
I want to show the date dynamically in the header of the RecyclerView and group the items of that date inside it.
My data class looks something like this
data class Feed(
val id: String = "&...
0
votes
0
answers
58
views
Infinitely scrollable list
Please tell me if there are already existing good libraries of horizontally infinitely scrollable scrollers, preferably with an indicator display at the bottom. I have found several implementations, ...
21
votes
6
answers
48k
views
How to solve this Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE
Have been trying to solve this but couldn't . this is udacity lesson where i am trying to create notifications using pending intent but there is problem with Pending Intent being Mutable i tried with ...
0
votes
1
answer
688
views
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.location/java.lang.String};
I working on a flutter project which uses location services.
There is one case where user 'denied permission forever', that time i need to open app location setting to turn it on and for that i'm ...
0
votes
0
answers
207
views
loop showing only 2 elements out of 10 after a live data observation
I am listening to an emit from a live data and want to loop through the list to Log them. if I do myList.toString(), I can see all 10 elements of the list. But my loop stops after logging two elements:...
1
vote
2
answers
3k
views
ML Kit barcode Scanner don't stop when first is detected
I'm trying to get two values from cameraX and ML Kit using the barcode scanner (rawValue and format) but I can't stop the scan and insert data into room when the first one is detected. My code ...
1
vote
0
answers
47
views
Twitter API Retweet Auth Failure
I'm trying to implement Twitter's Retweet API to retweet a specific tweet. But I'm having AuthFailureError while requesting that API. I'm unable to solve this issue and stuck for many days. Any help ...
0
votes
1
answer
1k
views
Download manger not able to download large files in android
By large file i mean 8.5 MB and by small files I mean 80KB to 1MB.
while download manager can download files up to 2GB
The below code is able to download small files but not large one. For the large ...
0
votes
1
answer
1k
views
Android Bottom Sheet is not working in Fragment
I have added the bottom sheet dialog on a fragment.
Right now I can't open it.
Whenever I click on the show button it doesn't work at all.
How can I fix this problem?
CreateFragment.kt
class ...
10
votes
3
answers
19k
views
How to get location using "fusedLocationClient.getCurrentLocation" method in Kotlin?
To request the last known location of the user's device, we can use the fused location provider to retrieve the device's last known location using getLastLocation(), but using getCurrentLocation() ...
1
vote
3
answers
2k
views
Async requests in Kotlin Android
I often get an error android.os.NetworkOnMainThreadException, when I try get info from some api. I know that this problem is related to the main android thread, but I don't understand how to solve it -...
0
votes
1
answer
965
views
Java equivalent of the Kotlin's secondary constructor "apply" [duplicate]
I am having a problem. I need something similar to Kotlin's secondary constructor "apply" in Java.
Kotlin:
private val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
color = Color.YELLOW;
...
0
votes
1
answer
112
views
Could someone take a look at my project and tell me why it errors before running?
Hi and thanks for reading in advance,
I have built a small project testing an adapter to populate a main activity view with a custom xml template [this template holds some fields that are populated by ...
0
votes
1
answer
259
views
Should the index passed to notifyItemChanged consider placeholder items?
PagingDataAdapter from Paging3 library internally manages two semantically different lists. adapter.snapshot() returns a ItemSnapshotList which includes placeholder elements. adapter.snapshot().items ...
0
votes
2
answers
1k
views
Defined color is not showing on drawable element - Android studio
I got a problem with color on my button.xml file in drawable folder.
I have 2 rounded buttons, one with green background and one with grey. This is the code for my grey rounded button:
<?xml ...
0
votes
0
answers
610
views
Can't consume localhost REST API on android application
I created a simple Restful Api using Spring boot and Kotlin, and I'm trying to consume it an android app but can't seem to do so. It's working fine on postman,in an Angular project and in the ...
0
votes
0
answers
179
views
How to open an activity from different package (imported module) in android?
I have an android project (let's call this Base) in which I have added/imported a new project.
Now, I have to open an activity in the new project (imported module) from the Base project.
How could ...
13
votes
3
answers
20k
views
Show trailing icon after text input from user in TextField Jetpack Compose
I am trying to:
make the trailingIcon of TextField composable visible only if the user enters some text other than white spaces.
Later when the user clicks the trailingIcon the text in the TextField ...
0
votes
1
answer
2k
views
What is Diff between "contains" and "in" (Kotlin)
fun main() {
val input = "ABC"
val output = "ABC,"
println(input.contains(output,false))
print(input in (output))
}
Output :
false
true
I just checked that, in ...
2
votes
0
answers
2k
views
E/ActivityTrigger: activityResumeTrigger: not whiteListed Error (kotlin- android)
In kotlin I am making app to signUp, Login and then after successfull signIn user will be forwarded to home screen where all users will be displayed, So I am fetching data from database to show in the ...