Category "kotlin"

Jetpack Compose Desktop switch to new window

Hey I'm pretty new to Kotlin and am trying my hand at a GUI as my first small project. For this I am using Jetpack Compose Desktop. I have already written a fir

Android Studio strings.xml: 'NBSP' suddenly appeared in my strings.xml files

I suddenly have the mention 'NBSP' in my strings.xml files, just before special characters (!, ?, ....) These 'NBSP' do not appear in my app when I run it. Als

Issue centering a QR square

I am writing an Android test app to see how to handle QR codes. This is the code for the main activity (MainActivity.kt) and a question is following. package me

Why using val instead of var in Kotlin? [duplicate]

I have seen some tutorials that recommend using val instead of var in Kotlin. I beleive val is like constant in Java right? Then how can we ch

Save data to local storage using Room

I apologize in advance if the question seems incomprehensible, since android development and kotlin are not my main stack. I will try to explain in as clear a l

Kotlin Flow - Some emitted events not received when collect

I am using MutableStateFlow. My flow type is sealed class with different states (Loading, Success, Error, etc). Initial value of my flow is empty: private val _

getSystemService NullPointerException

package com.example.myapplication import android.app.Activity import android.content.Context import android.os.* import android.util.Log import android.vie

Screen recorder app not detecting my screen size (width and height)

Source: here With the following segment of code all my Android devices record with a maximum width of 960 rather than the device width. val metrics = resour

After a coroutine scope is cancel, can it still be used again?

When we have a coroutine scope, when it is canceled, can it be used again? e.g. for the below, when I have scope.cancel, the scope.launch no longer work @Te

Kotlin 1.6.0 (There are no problems in 1.5.21) + Proguard + Gson (Registering an InstanceCreator with Gson...)

I have enabled Proguard and configured the rules minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFil

How to iterate over a Triple in Kotlin

I have list of three set of values which are related to each other. i.e. Roll Number, Student Name and School Name. I am using Kotlin Triple to store them. Belo

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