Questions tagged [kotlin]

Kotlin is a high-level programming language developed by JetBrains. Use this tag when you're having problems with the Kotlin language and standard library. This tag is often used alongside additional tags for the different targets (JVM, JavaScript, native, etc.) and libraries/frameworks (Android, Spring, etc.) used by Kotlin developers, if the question relates specifically to those topics.

76,382 questions
0votes
0answers
5views

sequence concatadapter based on data type

is it possible to use concatadapter based on data type. normal implementation of concatadapter is val concatadapter = listOf(firstAdapter, secondAdapter, thirdAdapter) while trying this code, for (...
0votes
0answers
7views

Implementing Flood Fill Algorithm in Kotlin

import java.util.Queue import java.util.LinkedList fun explore(row: Int, column: Int) { val length1 = minefield.size val length2 = minefield[0].size if (displayedMinefield[row][column] == ...
0votes
0answers
9views

OEM Permission Manger

I want more informations about OEM permission in android application and how to implement in Automobile AVD and what methods used in OEM permission to use in android automotive AVD
0votes
0answers
10views

I want to give an exception to the first character in inputType of editText with Kotlin

I want to make sure that the filter does not apply only the first letter in the numberPassword of the editText. Please give me an answer on what to do. android:inputType="numberPassword" ex ...
1vote
1answer
19views

Unable to multiply due compile error in kotlin

Beginner question - Any idea why my code won't compile? I based it on a code given in this codelab and the given code compiles just fine. Any help is greatly appreciated :) https://developer.android....
-1votes
2answers
30views

Java vs Kotlin from IOS pov [closed]

I’m an IOS developer, i decided to learn android development but there are two major languages, Java and Kotlin. From IOS development pov , is java to kotlin like objective-c to swift or is it ...
0votes
1answer
7views

What is the relationship between non-blocking I/O and Kotlin coroutines?

What is the relationship between Kotlin coroutines and non-blocking I/O? Does one imply the other? What happens if I use blocking I/O? How does this affect performance?
  • 5,042
0votes
0answers
16views

Why doesn't isAppearanceLightStatusBars affect on Status bar content color programmatically?

I've tried to change the color of status bar content using isAppearanceLightStatusBars: override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) ...
0votes
1answer
32views

Why can't I pass this method directly into the constructor, why do I need to use a lambda?

I just started to learn Kotlin yesterday, so brace yourself for a potentially stupid question. class MyCustomViewAdapter(private val callback: (position: Int) -> Unit) : RecyclerView.Adapter<...
0votes
0answers
27views

Android + Kotlin + Hilt: Cannot @Inject in a non activity class

I recently started learning Hilt, and for now it's giving me more headaches than happiness, but I like challenges, so let's go to the point. I'm having plenty of problems understanding how to inject ...
1vote
0answers
26views

How to parse the different type of json

When I call an api with specific parameter, I get a json like this: { “name”:“my name”, “family”:”my family” }, { “name”:“my name1”, “family”:”my family1” } But when I call same api with different ...
-1votes
2answers
27views

Type mismatch: inferred type is String but Int was expected , Kotlin

Task :app:compileDebugKotlin FAILED Type mismatch: inferred type is String but Int was expected
0votes
1answer
32views

Why is the no lateinit block in Kotlin?

The following code is valid Kotlin code: abstract class A { protected lateinit var v: X abstract fun f(): X class SubA : A() { override fun f(): X { return SubX() ...
  • 154
0votes
1answer
22views

How to access a function ,written in a fragment, in an activity

I have created a function in a fragment that gets data from the fragment's UI. I would want to access it in my main Activity so as to store the data in cloud firestore This is the function in the ...
0votes
1answer
27views

Kotlin flow map - make emit even if the value is same

I want to know the kotlin flow flatMap working with jetpack compose I am having a flow for search and i am calling the api each time the search value changes. var search = MutableStateFlow(""...

153050per page