Questions tagged [kotlin]

Kotlin is a cross-platform, statically typed, general-purpose high-level programming language with type inference. This tag is often used alongside additional tags for the different targets (JVM, JavaScript, native, etc.) and libraries/frameworks (Android, Spring, etc.) used by Kotlin developers, if the question relates specifically to those topics.

Filter by
Sorted by
Tagged with
0 votes
0 answers
17 views

How to use kotlin value class from java code?

I have kotlin value class: @JvmInline value class MyValueClass internal constructor(val rawValue: String) { companion object { @JvmName("myTestValueClass") fun String....
testivanivan's user avatar
  • 1,092
0 votes
1 answer
28 views

Hibernate fails Integer schema validation after the update

I used to run spring boot v2.x but now after updating it to 3.1.4 and getting all the new dependencies, it appears there is this annoying thing which is preventing the application to run and fails on ...
Zed's user avatar
  • 5,711
0 votes
1 answer
29 views

I have an error in Kotlin caused by a mutableState

The error is produced when I called the element, it seems that the first argument is of a different type than expected, but I don't understand why, I'm confused, by the way I'm learning jetpack-...
ivan ojeda's user avatar
0 votes
1 answer
16 views

Recycler view displaying only one item in a list

I am working on a small project where I can search up a city and it will return a list of cities with the same name but different locations. So far, I have implemented a search bar that can return a ...
Ben's user avatar
  • 1
0 votes
0 answers
16 views

Kotlin reflection application to parsing, an example

I am experimenting with Kotlin's reflection mechanism. However, things go wrong when I try to apply the function recursively. I have been learning Kotlin for less than a month now and I am completely ...
ArekBulski's user avatar
  • 4,660
0 votes
0 answers
13 views

Failed to notify project evaluation listener. To add 'ksp'. | Android Studio

I want to add the Room Compiler and Lifecycle Common in ksp, but the error occurred, I have the Android Studio version Giraffe | 2022.3.1 Path 4, Can anyone solve this problem? A problem occurred ...
Adolfo Gutierrez's user avatar
0 votes
0 answers
22 views

Function literal with a receiver invocation

I can't seem to find much documentation on why the second invocation of foo works. Using the receiver as an argument doesn't make sense to me. I realize it might be more of a use case for DSLs but for ...
ctapp1's user avatar
  • 576
0 votes
0 answers
10 views

KTOR API httpsredirect plugin causes redirect to wrong endpoint causing

I have a KTOR API ((https://github.com/Digital-Architects-Avans/rmc-api) which uses the authentication plugin to authenticate users accessing certain endpoints with an JWT token. Im also using the ...
AlexVDV116's user avatar
1 vote
0 answers
24 views

Does a LaunchedEffect to request focus work with AnimatedVisibility in Jetpack Compose?

I want to use an AnimatedVisibility to make a Text appear only when a button click is triggered, and then use a side effect to set accessibility focus on that Text once it is composed. Based on ...
user22376410's user avatar
0 votes
0 answers
4 views

Can I use an Android vector graphic with ArcGIS MapView graphicsOverlay.graphics?

I'm working with an Android ESRI ArcGIS map application. I want to use an android vector graphic resource on the ArcGIS mapView. I'm able to use a png resource. How do I use a vector graphic IE: flag....
Jay Bowman's user avatar
0 votes
0 answers
14 views

Move data from Screens - Jetpack Compose

I dont know why, it dosent work. I want to move data from Screen2 to Screen1 from TextField Theres no erros, and app works good on phone, but dosent show data.\ Main https://github.com/fornakter/...
4nakter's user avatar
  • 149
0 votes
1 answer
27 views

Android Kotlin assert list is empty but file is in folder

I am trying to read a file in via Android assets folder. For this I made a assets folder like here. I made a file and it is shows in the explore: When I run in the onCreate method: Log.d("Test&...
kabr8's user avatar
  • 343
0 votes
0 answers
13 views

Resilience4j: what exactly does waitDuration accomplish?

Regarding this example: https://resilience4j.readme.io/docs/examples-5 RetryConfig config = RetryConfig.custom() .maxAttempts(2) .waitDuration(Duration.ofMillis(100)) .retryOnResult(response -> ...
AlexC's user avatar
  • 3,485
0 votes
2 answers
16 views

Visibility of extension function defined in kotlin interface

I'm working on a sample project for the 'game of 15'. A cell on the game board is defined with: package board enum class Direction { UP, DOWN, RIGHT, LEFT; } data class Cell(val i: Int, val j: ...
pbuchheit's user avatar
  • 1,429
-1 votes
0 answers
14 views

Rate limiter for specific client IP?

The Rate limiter plugin in KTor does not distinguish between client IPs i.e. all clients use the same token bucket. Is there a way to have a unique bucket for each client IP address? The rate limiter ...
Cool_Coder's user avatar
  • 4,960
0 votes
1 answer
11 views

Kotlin Multiplatform expect/actual on Interface

trying kotlin multiplatform with compose, project bootstrap from Kotlin Multiplatform Wizard, as indicate in docs and strugle with expect and actual, basicaly i need to get Accelerometer, so i create ...
Neuber Oliveira's user avatar
-1 votes
0 answers
15 views

Retrofit2 - Upload image to server give an 500 Internal Server Error as response in android studio

I am trying to send image files from my android app to a back end server. On Postman, images are sent and response code:200 is received. enter image description here However, trying to send images ...
depressed's user avatar
0 votes
1 answer
15 views

Kotlin incompatibility problem when adding ads/billing to older Android app

I'm working on a legacy Android project which is working fine on the latest Android API 33 (Gradle version 8). I get a problem when I'm trying to add ads/billing by including the following imports in ...
ZP007's user avatar
  • 592
-1 votes
0 answers
8 views

How to prevent VS Code from changing svg-processor files

How do I prevent (I assume) VS Code from constantly changing the 4 files in svg-processor? Adding it to .gitignore would maybe be a solution but won't it add this to everyone's .gitignore since I'm ...
Chefski's user avatar
  • 29
1 vote
1 answer
18 views

Emitting on upstream flow inside onSubscription is not collected - despite what documentation says

The documentation for SharedFlow<T>.onSubscription says: (emphasis mine) Returns a flow that invokes the given action after this shared flow starts to be collected (after the subscription is ...
Simon Forsberg's user avatar
0 votes
0 answers
6 views

i can not use intent to another activity, every time i have null, where problem?

`enter image description here enter image description here enter image description here in AuthActivity im create userLogin, after if we can auth, im send in BasketActivity my login, i wanna do my ...
tryouq's user avatar
  • 1
0 votes
0 answers
7 views

Retrofit Exception: java.lang.IllegalStateException: Already executed [duplicate]

I developed an Android Apps with retrofit which is used to access Django REST API. class ListAdapter<T : ViewBinding>(private val user: String, private val chafingDishData: List<ChafingDish&...
Jingda's user avatar
  • 43
0 votes
0 answers
17 views

Center a recyclerView card item in a specific view after scrolling

I am trying to make a slot game with a vertical RecyclerView and a button, when the user hit that button, it automatically scrolls the list. Meanwhile, in my main activity XML, I have a view with a ...
widy 's user avatar
0 votes
0 answers
5 views

Add react native module inside android kotlin app

I am trying to add a new React native module to an existing android application. I already was able to make the android app open the react native activity following the guide that React Native ...
Bruno Ramos's user avatar
1 vote
1 answer
40 views

In Jetpack Compose, how can you check to see if a screen has re-composed?

I want to be able to set accessibility focus on a Text object, but only once it becomes visible (through mutable state boolean that is remembered). This means that the screen needs to finish re-...
user22376410's user avatar
0 votes
0 answers
13 views

My cutsom bottom navigation has lag and jump frame when I switch between items

I created a custom bottom navigation and when I want navigate from home fragment to plan fragment occurring lag and jump frame but on the contrary is smoother(probably because I used more elements in ...
hassan golestani's user avatar
0 votes
0 answers
5 views

I cant add onclicklistener on a constaintlayout

package com.example.nagaduserapp.Fragment import android.content.Intent import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import ...
Sayem's user avatar
  • 1
0 votes
0 answers
15 views

java.lang.ClassNotFoundException running Kotlin jar library

I am creating REST API for ClamAV https://hub.docker.com/r/clamav/clamav and I try to use java clamav-client https://github.com/cdarras/clamav-client for this purpose. I have built clamav-client and ...
Eduard Nickel's user avatar
0 votes
0 answers
3 views

How to create an infinite surface in Android?

I want to create an app with many objects on a surface, and you can move through the surface in any direction, also zoom in and out. Like for example Miro or Figma. Is it possible with some libraries ...
Dmitry Sukhov's user avatar
1 vote
1 answer
25 views

What is the difference between "x is T" and "(x as? T) != null"?

In Kotlin, when writing a generic, non-inline function, x is T throws a compiler error due to type erasure. fun <T> example(foo: Any, bar: T) { if (foo is T) { // compile error // ......
Adam Burley's user avatar
  • 5,696
0 votes
0 answers
19 views

multithreading in kotlin - running some part of a function concurrently

I have this function i want the part were list 'values' is being created to run in threads or concurrently. I want to make sure that the function waits for values list while equating as many fields as ...
Youssef Kandil's user avatar
0 votes
0 answers
11 views

How can I secure my Android app against unauthorized modifications or APK patching using PackageManager signatures?

I would like to ask a question regarding Unauthorized Application Modification or APK Patching in the context of Android. How can I secure my application against this threat? Is using PackageManager ...
Takeshi567's user avatar
0 votes
1 answer
12 views

Retrieving data from DataStore using runBlocking

Would it be a good approach to use runBlocking in following implementation? Would it cause UI to be laggy? I use it all in my viewModel. lateinit var centralReturnsPaging: Flow<PagingData<...
Cuyer's user avatar
  • 107
0 votes
0 answers
10 views

How can I fix the error RECEIVER_EXPORTED

I encountered the error: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.lyricsify/com.example.lyricsify.MainActivity}: java.lang.SecurityException: com.example....
Slim Shady's user avatar
0 votes
0 answers
25 views

KotlinJS React - Context and Reducer

I am trying to use Context and Reducer, but I just cannot get it to work for hours. I followed this Tutorial: https://react.dev/learn/scaling-up-with-reducer-and-context A little stripped down and ...
Splitframe's user avatar
0 votes
1 answer
32 views

Analogue match parent in compose

Is there any analog of match parent in compose? How can I make the red and blue text the same height if the blue text is shorter? I want to ensure that the remaining part is filled with blue to the ...
TOvchinnikova's user avatar
0 votes
0 answers
43 views

Google In-App Review - Android native Not working

I am currently working on a requirement to display a In-App review popup within the app for user reviews. Unfortunately, I am encountering difficulties in getting the In-App Review popup window to ...
Shubhank Gupta's user avatar
0 votes
0 answers
14 views

createBitmap is not working in DialogFragment Kotlin

I am trying to take capture the specific view in DialogFragment But createBitmap is giving me empty value please help me out how to fix these issue xml <androidx.constraintlayout.widget....
Atul Dhanuka's user avatar
  • 1,453
1 vote
1 answer
47 views

Giving completion instructions ahead of calling send with MockProducer

I have the following code (Obviously made as an example): class RandomClass( val producer: Producer<String, String> ) { fun randomFunction(): Boolean { // Using .get() because I want to ...
Stene's user avatar
  • 157
0 votes
0 answers
6 views

Rotate the appWidgetIds continuously with time

I am creating the clock widget in my app. I want to rotate the needle with time. I have tried different ways but have not been successful yet. If I don't apply any method to rotate the widget appears [...
Iqra Riaz's user avatar
0 votes
1 answer
29 views

why is the gradle syntax of my projects different from that of everyone else's?

in my kotlin android projects the gradle syntax must look like this way, and doesn't support many of the features/lines posted around in tutorials and other answers here, why? in my projects, the ...
M.KH's user avatar
  • 270
0 votes
0 answers
25 views

Invoke Kotlin suspended function inside reactive stream

I use Spring Boot app and Kotlin lang. I want to receive messages though the reactive Kafka consumer, and then pass these messages to the suspended Kotlin function and use coroutines there, then get ...
user2625402's user avatar
0 votes
1 answer
12 views

Create another module in Compose Multiplatform Project

I'm currently building a project with Compose Multiplatform, and I'm wondering to make this project structured with multi-module clean architecture. Here's my current modules: I'm looking for adding :...
Raka M.A's user avatar
  • 119
0 votes
0 answers
14 views

Multiple usb-devices in device-filter.xml

I was wondering if it's possible to have multiple usb-devices in the device-filter.xml file. I have different product-id's for each usb-device. Although I can do this in my code like this: if (dev....
mohammed_sajid's user avatar
0 votes
0 answers
10 views

Best option to flatten and transform a nested array in kotlin?

I want to convert 1 complex model class into a simple model class in my project. Complex model class sample is as follows. Books (id, title,content) Content (texts[],photos[]) Photo(item) Item (url) ...
Droid's user avatar
  • 77
0 votes
0 answers
19 views

Application is reboot when revoking application permissions

When I open settings from within the app and then cancel permission, the app reboots. How can I detect when the app is rebooted?
NDC00's user avatar
  • 11
0 votes
1 answer
20 views

How to underline a Text upon clicking it?

I am trying to get my text displayed by "$item" underlined upon clicking by using onClick. I have used Divider() to create the underline and was trying to assign a default colour = ...
vibe_tribe's user avatar
0 votes
0 answers
7 views

Why does "android resource linking failed error"?

Android resource linking failed com.example.menuandflexbox.app-mergeDebugResources-35:/layout/activity_signup.xml:195: error: resource drawable/baseline_calendar_month_24 (aka com.example....
Hasnain Gujjar's user avatar
0 votes
0 answers
23 views

I generated a disparity map using OpenCV's Stereo Vision, but all I see is a black screen

android screen image The top left is the left camera, the top right is the right camera, the bottom left is the left camera converted to gray, and the bottom right is the disparity view. The Python ...
AKA _Aptenia's user avatar
0 votes
0 answers
10 views

Player controls not showing up in Android Auto

I have setup the mediasession, along with the playbackstate, metadata and callback. mediaSession = MediaSessionCompat(this, "MusicService") .apply { setSessionActivity(...
Ian Lee's user avatar
  • 91

1
2 3 4 5
1861