Category "kotlin"

Compile the Kotlin android file through the command line compiler, show unresolved reference: synthetic

I used kotlin-android-extensions the kotlin code is simple import android.os.Bundle import android.widget.TextView import android.widget.Toast import kotlinx.an

Get Currency symbol of only one character (e.g $,₹, etc) (Locale doesn't matter) android kotlin

i have currency code (e.g. USD,INR,etc...). I want to get symbols of only one letter of those codes (e.g $,₹, etc). i have tried to find many solutions li

E/FirebaseInstanceId: Token retrieval failed: AUTHENTICATION_FAILED - what changed?

I'm not sure what's going on here, I pulled my recently updated repo and every time I open the app to debug it on an emulator I get E/FirebaseInstanceId: Token

KMM: Compilation failed: Unexpected IrType kind: KIND_NOT_SET

I'm trying to run tests in the shared library. Setup (versions should be the same for both machines - all are up to date as of today): Kotlin 1.6.21 (tried 1.6.

What does the suspend function mean in a Kotlin Coroutine?

I'm reading Kotlin Coroutine and know that it is based on suspend function. But what does suspend mean? Coroutine or function gets suspended? From https://kotli

How can I change CardViews background color based on user's option in Kotlin?

I have 2 fragment pages. The first of these pages is the page where the user is given options. The other page is the page that is displayed according to the opt

Is it possible to download the first 100 lines of a big file with millions of lines from S3?

I have multiple 100MB raw files with series of user activities in CSV format. I only want to download the first 100 lines of the files. The problem is that each

Share Intent text using Kotlin on Android

I want to share text in my CardView using share Intent using kotlin but there is a problem with last line in the code in kotlin the code val shareIntent = I

CQRS, Is it bad practice using the same class/model for write and read

So let's say I have a product order system. I have several classes that may look like this. data class CreateOrderCommand( val productId: String, val produ

Dynamically adjust position of textview to always be at bottom of current camera preview

My layout is shown below. i want the textview to appear at the bottom of the camera preview. but this is not the case when the user changes the aspect the ratio

OpenCV: Architecture "aarch64" is not supported for Apple M1, but for Intel it's ok

I have a simple application with tesseract with Kotlin. It works great on macos intel. But when I try to run it on Apple M1, this error happens: Exception in th

kotlin inverse boolean safe casting

Let's say I have an object Response. Now I would like to check a boolean variable, success, under Response and do an early return is response is not successful.

What is difference between "as" and "is" operator in Kotlin?

In Java, I can write code like: void cast(A a) { if(a instanceof Person) { Person p = (Person) a; } } In Kotlin, what should I do? Us

Kotlin Coroutines with returning value

I want to create a coroutine method which has returning value. For example) fun funA() = async(CommonPool) { return 1 } fun funB() = async(CommonPool) {

Broadcast receiver not working for INITIALIZE_PROGRAMS action

I'm developing an Android TV app, and I'm setting up a broadcast receiver to run a work class when the user installs the app. Following the Google documentation

Databinding unresolved after move to Gradle Kotlin DSL build scripts

I had a working build, including databinding, but after migrating my Gradle build scripts to Kotlin DSL, I now have unresolved symbol errors for every use of im

How to create an instance of Room Dao or Repository or Viewmodel in GlanceAppWidget class using Jetpack Compose

I am trying to load list of data in App Widget using jetpack compose and i have stored in Room Local database, how i can retrive the data in GlanceAppWidget cla

How do I create a button in kotlin without xml?

How do I make a button without any XML? I tried XML but it did not work and it is "Old" I heard.

AssertionFailure: null identifier when try to save identifying one-to-one relation

I'm trying to make identifying relation with Spring Data JPA. And following is my (simplified) entities. @Entity class AuthorizationCodeEntity( @MapsId

Kotlin Android View Binding: findViewById vs Butterknife vs Kotlin Android Extension

I'm trying to figure out the best way to do Android View Binding in Kotlin. It seems like there are a few of options out there: findViewById val button: Butto