Category "kotlin"

Kotlin Arrays: Lookahead without going out of bounds?

I have a long array of Booleans and I want to extract from it the index positions of TRUE followed by FALSE patterns. For example, this array arrayOf(true, fals

How to handle Fragment to not load again when coming from another fragment in Navigation Component in Android?

Scenario: I have 2 fragments ProductList and ProductDetail in my nav graph. And when i click on any product it opens the ProductDetail fragment using findNavCon

I am unable to use auto Image slider but not able to do so

I just wanted to use Auto image Slider, but after adding all the dependencies and other requirments like jitpack.io still I am unable to use sliderLayout of aut

I just need the local currency symbol in a String depending on the country the user is, in Kotlin for Android Studio

Is there a simple way for the system to return the local currency symbol? I been searching but I cant find anything, in swift you can achieve this with two line

viewBinding is not working with error (Android studio 4)

I make android application with kotlin by Android studio 4 (4.11). findViewById is deprecated in Androd Studio 4 ,then I use viewBinding. https://developer.andr

Under which condition should I choose the JDK provider and its pros and cons? [closed]

May I know what are the JDK provider choices for Spring Boot if I am using Kotlin with Java 8 along with AWS EC2? I saw many providers out the

In kotlin, how to filter a list after using the map

How I filter a list by an list of id, after a map? I get an object list with findAll, use map to send a list, but I need show the list only some ids eg: (1,2,5,

In kotlin, how to filter a list after using the map

How I filter a list by an list of id, after a map? I get an object list with findAll, use map to send a list, but I need show the list only some ids eg: (1,2,5,

Right place to map to Domain in Android clean architecture

Me and my colleague are having a debate as to where would be the right place to map our entity objects or remote dto objects to plain simple domain objects. Our

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 {