Category "kotlin"

How to use Jackson JsonSubTypes annotation in Kotlin

I'm trying to convert some Java code that uses Jackson's @JsonSubTypes annotation to manage polymorphism. Here is the working Java code: @JsonTypeInfo( us

java.lang.IllegalStateException when using State in Android Jetpack Compose

I have ViewModel with Kotlin sealed class to provide different states for UI. Also, I use androidx.compose.runtime.State object to notify UI about changes in st

List clear and addAll in single statement Kotlin

Is there any method in kotlin which replaces below two line into one. I know i can create a extension function but I'm eager to know if it already exist in kotl

AAPT: error: 'techport' is incompatible with attribute layout_constraintStart_toEndOf (attr) reference|enum [parent=0]

hello everyone, i'm new to programming. I was doing the layout and when starting the emulator I got this error D:\SkyScanner\app\src\main\res\layout\fragment_m

CoroutineExceptionHandler not executed when provided as launch context

When I run this: fun f() = runBlocking { val eh = CoroutineExceptionHandler { _, e -> trace("exception handler: $e") } val j1 = launch(eh) {

JCenter deprecation; impact on Gradle and Android

Should I be worried about JCenter being deprecated? Why should I migrate my libraries from JCenter to other Maven repositories? Can I continue to use jcenter()

How to wait for khttp (kotlin) response in Android

I've been trying to use khttp to send an .jpg file in an android activity but haven't been able to make it work. fun sendImage(view: View) { try {

Kotlin-Android First App Unresolved Reference TextView Button etc

I'm new to Android & Kotlin development. I wanted to get started with a simple "Hello World", but am already running into problems. I added a Textview to

how to make thumbnail image with initials two char from name android?

I want to thumbnail initials with two word for my image view like "Peter Parker" but am able to get only one word "P"while running code how can get second word

MutableLiveData: Cannot invoke setValue on a background thread from Coroutine

I'm trying to trigger an update on LiveData from a coroutine: object AddressList: MutableLiveData<List<Address>>() fun getAddressesLiveData(): Live

Android - DataSource vs Repository

You hear a lot of people talking about repositories and datasources when talking about design patterns like MVVM or MVI. I've been creating repositories for thi

Cannot find setter for attribute app:visibleGone

I am trying to implement the MVVM architecture in my android application. I'm using Kotlin for the same. This is my binding adapter class: class BindingAdapte

"error: cannot find symbol" when building for Android in flutter

I keep getting this error when trying to build for android in my flutter app. This all happened when i added firebase messaging version 7.0.3. Even after removi

I want to detect if a JVM Class is a Kotlin class or not

I want to do special functionality if I encounter a Kotlin class as compared to a generic Java class. How can I detect if it is a Kotlin class? I was hoping

How do I hide the status bar in my Android 11 app?

Every method I came across to hide status bar of my Android app is deprecated in Android 11. Does anyone know about any current acceptable method? Also I use Ko

How can I easily cache Kotlin Objects in Redis using json via Jackson?

I have a Spring boot app written in Kotlin where I would like to enable caching in Redis. I'd like to have the objects stored as serialized JSON and ideally don

Android Studio quick documentation always "fetching documentation"

I just moved to Android Studio from Eclipse, and I found that it always shows "fetching documentation" when I use quick documentation (Ctrl+Q). How can I solve

How to tell the difference between Java and Kotlin code?

As a beginner to Android app development, I am finding code examples that do not identify whether they are written in Java or Kotlin. Even StackOverflow questio

Problem after adding external dependencies in IntelliJ

I'm starting a project using the KorGE library, and I would like to use Retrofit as XML parser. So I try to follow this guide, which seems fine, but I just poor

Documentation for the XML format for files referenced from the kotlinc -Xbuild-file argument

Where is the documentation for the XML format for the contents of files referenced from the kotlinc -Xbuild-file argument? The XML looks something like: <mod