Questions tagged [kotlin]
Kotlin is a cross-platform, statically typed, general-purpose high-level programming language with type inference. 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.
kotlin
96,544
questions
-2
votes
0
answers
25
views
Linking of multiple apps [closed]
If we create an flutter application (Android + iOS) using visual studio code "we have 3 applications named A, B & C. A is the main app and the other two apps (B & C) are separate apps. i ...
1
vote
2
answers
34
views
How to draw a hexagon with rounded corners on Android Canvas?
I want to make a hexagon with rounded corners, but I don't have any idea how to do it. I try it with different methods like: cubicTo, arcTo, etc.
My code to draw this
fun Path.customHexagon(radius: ...
1
vote
1
answer
25
views
how do i observe changes made to kotlin's MutableList?
var questionPool: MutableList<String> = mutableListOf()
questionPool contains string ids.
ids are added and removed throughout the application's lifecycle.
How can i execute a function foo ...
0
votes
1
answer
30
views
Using a str variable as a key for a map always returns null
I am trying to use a Map without success.
I have whittled it down to a bare-bones case:
I create a Map with four entries:
("fruit", 25)
("veg", 30)
("baked", 35)
("...
0
votes
1
answer
15
views
How to clear TextField upon first focus in Jetpack Compose
I am wondering if anyone has tried to modify the value of text in a TextField Component upon clicking into it the first time. I.e. There is example text, you click on it and the text disappears, with ...
0
votes
0
answers
8
views
Paginated Data, Should I keep it as state of the screen or only internal state to recycler view adapter?
How to manage paginated data in a StateFlow for a RecyclerView?
Should I store only the last fetched page in the StateFlow and accumulate data in the adapter, or should I store the entire dataset in ...
0
votes
0
answers
29
views
How to prevent a SharedFlow collect values when the activity resumes?
I have found an issue where SharedFlow does not collect values when the activity is open. So I set replay = 1, which worked fine initially.
However, I found that when the app is sent to the background ...
0
votes
0
answers
19
views
Put android lib .jar online (Github)
I have several .jar libraries in my project.
I do not have access to the source code, only the .jar.
I would like to make the implementation of these files available via github.
At the moment:
...
0
votes
0
answers
11
views
Separating Music Files by USB Port on Android Tablet
I'm working on an Android project that involves playing music on a tablet. This tablet has multiple USB ports, and my goal is to read and display the music from each connected USB device separately, ...
0
votes
0
answers
45
views
How can I estimate the difference in performance of a HashMap lookup vs List iteration in Kotlin?
I am working on an application that needs to map pdf documents to corresponding json data files (see: Kotlin data structure for efficient lookup of nested data for more details). In trying to ...
0
votes
2
answers
20
views
How to change the value of a Textview present in another activity if value of Textview in my current Activity changes in Android?
So I have two activities named "MainActivity" and activity named "Second", so my MainActivity has it's own Adapter class named "PractiseAdapter". So my MainActivity ...
0
votes
0
answers
12
views
Spark doesn't recognize not null fields while reading from the source
I'm trying to read data from database and then save it to parquet file using Kotlin and Apache Spark.
JDBC Driver I use: com.mysql.cj.jdbc.Driver
val customerDf = spark
.read()
.jdbc(
...
0
votes
1
answer
42
views
Kotlin data structure for efficient lookup of nested data
I am currently working on an application that needs to create a mapping between document pdfs and corresponding JSON data files. The files are coming from a third party so I have no control over their ...
0
votes
0
answers
20
views
Android - migration to Kotlin 2.0 causes errors
My Android App was working fine until I started migrating to Kotlin 2.0.
All I changed in the build gradle was:
changing these two lines
id("org.jetbrains.kotlin.android") version "1.9....
2
votes
1
answer
28
views
How do I combine two different classes into one list?
I have two classes, the code is below. I need to put them in one list and sort them by the variable "time". Each class has "time" of type string.
data class Event(
var data: ...