Category "kotlin"

Custom view custom attribute not being set without @{}

So I've got a custom view with this attribute: private var mLabelText: String = "DEFAULT" var labelText: String set(value) { if (mLa

How to check if a class has overriden a default method from an interface using Reflection in Kotlin or Java?

I have an interface with a default method, and two classes which implement this interface. One of the classes overrides the default method, and the other does n

How to fill the spinner with a custom object with coroutines and implement your onItemSelected logic related to that object?

For example, let's use this class: data class Person ( var id : Long, var name: String, var imageUrl: String ) I need to fill my spinner with name

Can't add buildFeatures to my gradle file when trying to implement viewbinding

I'm sure there's a simple solution to this and I have searched but found no clear solution. I'm trying to implement viewbinding into my Kotlin project (Kotlin /

Solo Learn practice how to calculate parking fee based on some conditions in Kotlin

You are making a car parking software that needs to calculate and output the amount due based on the number of hours the car was parked. The fee is calculated b

Button Long Press Listener in Android jetpack compose

I am having an Android Composable UI with a Button. How can I track button long press events? I got it working for the Text long press, but for Button, It is no

Kotlin for a new application for stock management?

I am searching a new language/framework for a v2 of a old app we have in my company, for stock management, and I was wondering if Kotlin could do the work. Basi

Uploading files Kotlin Spring Boot

So, I am trying to make and upload file(s) functionality, from some blog posts and stackoverflow questions I got this solution: @PostMapping("/file/upload") fun

Uploading files Kotlin Spring Boot

So, I am trying to make and upload file(s) functionality, from some blog posts and stackoverflow questions I got this solution: @PostMapping("/file/upload") fun

Is there any way to stretch layout when device has cutout (notch)?

I'm making my project able to handle notch/cutout because users can see big black rectangle area when in landscape mode. Since my app's layout will be safe afte

Kotlin @Serializable annotation not working in IntelliJ

I'm trying to use the @Serializable annotation in Kotlin. I can build the project with Gradle, but it's showing up red in IntelliJ and when I hover on the @Seri

Logcat does not show an error message when an exception is thrown in the coroutine (Xiaomi)

It shows only I/Process: Sending signal. PID: xxxxx SIG: 9 I have tried to enable debug mode System.setProperty(DEBUG_PROPERTY_NAME, DEBUG_PROPERTY_VALUE_ON) b

MutableStateFlow force update / notify collector

MutableStateFlow doesn't notify collectors if the updated value equals the old value (source). I've found a workaround for this, but it doesn't scale well for c

Updated intellij messed up Kotlin with 'Check your module classpath for missing or conflicting dependencies'

Lot's of frustration here. I decided to follow the pop-up prompting an intellij upgrade so it'd stop nagging me. And now I get a compiler error on certain parts

Ktor - kotlinx.coroutines.channels.ClosedReceiveChannelException: Channel was closed

I am receiving back this kotlinx.coroutines.channels.ClosedReceiveChannelException upon about 50% of my api calls to a post url through Ktor HttpClient. Our cod

How is Dart "sound null-safety" different from Kotlin null safety?

This Dart official video states that Dart's so-called "sound null safety" is better than Kotlin's null safety design, because it can optimise the code based on

Kotlin I can't add element to the end of the arrayOf

the problem is, that I can't understand differences between: ARRAY OF, LIST OF and ARRAY LIST OF I know, that arrays are mutable in nature, but list not. When I

RecyclerView Fragment calling itself onClick of the ListView with changed data using bundle in Android Kotlin using MVVM to separate data in VM class

So its just I want to ask question is in RecyclerView Fragment as, I want to buid a RecyclerView Fragment in MVVM by seprating the data in ViewModel separate Cl

Spring boot + Kotlin + MongoDb: Cannot resolve reference to bean 'mongoTemplate' while setting bean property

I am trying to make a simple application using kotlin and spring boot which connects to mongodb and makes some operations there, however I am facing this issues

Plugin 'kotlin-parcelize' not found

Google is recommending users to migrate from kotlin-android-extensions to kotlin-parcelize. However, Gradle sync fails with the following error: Plugin [id: 'ko