Category "kotlin"

Setting output path for Kotlin/JS distribution / webpack output

When building my project using the browserDistribution Gradle task, Kotlin/JS puts the output which has been processed by webpack into /build/distributions/myPr

Type mismatch when serializing data class

I'm following this example to serialize a data class. When I do so, I get this build error: Type mismatch: inferred type is Data but SerializationStrategy<Ty

Detect Adapter onclick Listener method in activity using Entrypoints Dagger hilt

I need a help to detect adapter onclick event in activity class with the help of dagger hilt. Step1 : I have created one interface class which name is ItemClick

Android ViewModel - "by activityViewModels" called before "by viewModels"

After some time away from android development I'm trying to start again with a simple project. I've created a new project picking the "basic activity" option wh

Is it possible to use kotlinx-datetime with Gson

I have JSON data which is retrieved from the local realm database. I'm trying to convert it into the corresponding data class. I have an ISO date field { ....

How to update jetpack compose slider state outside of the slider

So, I'm using the Jetpack compose for my app and I have a state with a float value in the viewModel. This value can be updated outside of the slider; but also f

Mocking scope function in Kotlin

I am using following object creation methods in kotlin class Resource( referenceFactory: ReferenceFactory, id: String,

How do I wait until data from Preferences DataStore is loaded?

I'm trying to make a LibGDX Live Wallpaper. But I think that is unrelated to the problem I'm having at the moment. Basically, I'm storing the wallpaper's settin

Mocking scope function in Kotlin

I am using following object creation methods in kotlin class Resource( referenceFactory: ReferenceFactory, id: String,

error: [MissingType]: Element 'xxxxx.AppDatabase.room' references a type that is not present

error: [MissingType]: Element 'xxxxx.AppDatabase.room' references a type that is not present I get the mentioned error in the title when I try to compile my cod

How to restrict route access in ktor framework?

How to restrict route access in ktor framework? //only admin post("/add") { call.respondText { "add" } } post("/delete") { call.respondText {

Kotlin Flow returned from Room does not update when an insert is performed from another Fragment/ViewModel

I have a Room database that returns a Flow of objects. When I insert a new item into the database, the Flow's collect function only triggers if the insert was p

Reading a text file in Android Studio Kotlin and making pointers

I am fairly new to Android + Kotlin, however I am wondering if there is a faster way to read a text (.pgn) file and mark pointers to places in the file for late

Router.router path param is empty

I have a API,created by val router = Router.router(vertx) router.patch("/api/v2/user/:userId/names") if user id is not passed getting message - "error":

kotlin.UninitializedPropertyAccessException: lateinit property postFragment has not been initialized on FragmentStateAdapter Dagger Hilt

i tried to implement viewpager2 with tabLayout with dagger-hilt. then i got error when implementing viewpager2 on dagger hilt "kotlin.UninitializedPropertyAcces

How can I passs a method except parameter in Kotlin?

I hope to pass a method which implement MediaRecorder.OnInfoListener. At present I use Code A to pass the method which implement MediaRecorder.OnInfoListener.

Spring cloud stream with kafka streams binder: how to set `trusted.packages` for a Stream Processor (that's different than consumer and producer)

I have a simple stream processor (not consumer/producer) that looks like this (Kotlin) @Bean fun processFoo():Function<KStream<FooName, FooAddress>, KS

Convert ByteArray to Base64 in Kotlin

I am trying to convert a ByteArray to Base64 in a Spring project, written in Kotlin. I have checked existing posts but they didnt help me. Actually I am trying

The most efficient solution for finding the minimum value

I have a list of Sugar. The Sugar class has two field: price and weight: data class Sugar(var price: Double, var weight: Double) And I need to find max/min val

How to define a variable which implement the interface in Kotlin?

I hope to define a variable mAction which implement the interface MediaRecorder.OnInfoListener . But Code A isn't correct, how can I fix it? Code A val mActio