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,496
questions
0
votes
0
answers
10
views
Android compose `NotificationListenerService.onNotificationPosted` is never called
I'm trying to add a notification listener to a Kotlin android compose project:
My AndroidManigest.xml:
<application>
<!-- ... -->
<service
android:name=&...
-1
votes
0
answers
10
views
Could not find gradle-8.3.1.jar (com.android.tools.build:gradle:8.3.1)
I want to create a new project I got this error:
A problem occurred configuring root project 'My Application'.
Could not resolve all files for configuration ':classpath'.
Could not find gradle-8.3.1....
0
votes
0
answers
11
views
Crash on Destroy Method: "View ... does not have a NavController set"
I am getting a crash in the onDestroy method with the following error:
`Fatal Exception: java.lang.RuntimeException: Unable to destroy activity {com..presentation.screens.main.MainActivity}: java.lang....
0
votes
0
answers
17
views
make video full screen on click
i'm writing app using kotlin and i facing this problem
i can't switch video player to full screen
this is my xml file :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android&...
0
votes
0
answers
7
views
Android websettings.setcachemode is globally?
I called clearCache in an Android WebView to delete the cache. However, I found out that this method works globally for the application’s WebView.
clearCache
Added in API level 1
public void ...
2
votes
1
answer
21
views
Kotlin sealed class inheritance not working without casting to sealed class
I am trying to use sealed class inheritance to organize data in a recyclerview which consumes data through PagingData, and I have been able to make it work but there is situation that I could not ...
0
votes
0
answers
8
views
Schema validation failed in Realm/Atlas due to an unknown type
I have a Kotlin Multiplatform app that I'm trying to get to work with Realm/Atlas. When I try to do a Realm.open(it) it says:
IllegalStateException@29576} "java.lang.IllegalStateException:
[...
0
votes
1
answer
17
views
How to Pass ArrayList of Custom Objects Between Activities in Kotlin on Android Studio
I'm working on an Android project in Kotlin where I store user information in a custom object. I need to pass an ArrayList<CustomObject> from one activity to another and display the stored ...
-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
31
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
22
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
28
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
13
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
26
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
17
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
43
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
19
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
0
answers
8
views
Spring Rule Engine Script Kotlin - cannot access class 'java.lang.Class''
I have a kotlin script project for rule engine in my spring boot project. It gives an error when running the script.
I checked the 'dependency dependencies, but I couldn't find the problem.
...
0
votes
1
answer
41
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
19
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: ...
0
votes
1
answer
20
views
Slow Gradle shutdown after testing with Testcontainers, Kotlin, Spring Boot
I have a Kotlin Spring Boot application that integrates with redis, and builds with Gradle. Recently I added some Testcontainer integration tests to make sure everything is working as intended. I ...
0
votes
0
answers
8
views
App Locker for other applications in my application
I'm developing an android application with kotlin which I need to lock some installed apps in my device.
first of all I'll display all installed app in a fragment and I did this successfully.
second ...
0
votes
1
answer
13
views
permission for saving pdf Android studio
i created a simple app that generated a pdf with 2 pages now i need to share the pdf and also save it in the device from what i already know it requires permissions to do that.
i am new to this and ...
2
votes
1
answer
44
views
Migrating to Kotlin 2.0.0 causes compile time errors associated with nullablity
I am currently migrating my Android application to Kotlin 2.0.0:
val myConfig: Configuration? = null
val myFrameRate: String? =
getPreferences(Context.MODE_PRIVATE).getString("my_FrameRate&...
-1
votes
2
answers
48
views
how to solve the stupid error your project requires a newer version..?
BUILD FAILED in 1m 21s
Running Gradle task 'bundleRelease'... 82.6s
┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────────┐
│ [...
0
votes
0
answers
14
views
Ediitext getting under keyboard kotlin android
I have a fragment, in that i have a scrollview,(edittext inside scrollview) and recyclerview as well. when i am clicking edittext, keyboard is hiding it.
I have only one Activity and many fragments ...
2
votes
1
answer
50
views
Resolving scroll conflict: PullToRefresh (vertical) vs. Horizontal Pager in Jetpack Compose
I'm developing a screen in Jetpack Compose that combines two scrolling components: a PullToRefresh for vertical scrolling and an ImageSlider implemented using HorizontalPager for horizontal scrolling. ...
0
votes
0
answers
11
views
Getting "java.lang.NoClassDefFoundError: io/grpc/ClientStreamTracer$InternalLimitedInfoFactory" When Running gRPC Kotlin Client
I'm trying to run a gRPC Kotlin client using Spring Boot, but I'm encountering the following error when executing my main function:
java.lang.NoClassDefFoundError: io/grpc/ClientStreamTracer$...
0
votes
3
answers
29
views
Relative Layout In Android - Centerof
In a Relative View Group, we can place one view above or below another view: "layout_above" and "layout_below." etc...
Now, the problem I have is that if I want to position one ...
0
votes
0
answers
14
views
Error "Caused by: org.gradle.api.UnknownDomainObjectException: SourceSet with name 'commonTest' not found." while trying to register a gradle task
I have the following issue with Android Studio in my Kotlin Multiplatform Project.
I want to add conformance tests to my project and for this i wanted to add a new source set and have all the test ...
0
votes
1
answer
19
views
While creating AWS SQS queue in kotlin getting aws.smithy.kotlin.runtime.serde.DeserializationException: Unexpected JSON token at offset 0; exception
I am trying to create AWS SQS queue, getting the below error:
aws.smithy.kotlin.runtime.serde.DeserializationException: Unexpected JSON token at offset 0; found \<, expected one of {, \[, ", ...
0
votes
0
answers
51
views
Adding module-info.java to a Kotlin project causes build error
I was trying to make a JavaFX project with Kotlin, Gradle on IntelliJ IDEA.
Using Java 17.
At first, I didn't used module-info.java, and it worked well, but it warned me
"WARNING: Unsupported ...
0
votes
0
answers
17
views
How to retrieve sleep and cycle tracking data from Google Fit to our app?
I want to get sleep and cycle tracking data from Google Fit to my app. I am aware that the API is no longer in use and we need to use the Health Connect app. I have retrieved most of the data, but I ...
0
votes
0
answers
13
views
How to create a parent project containing two independent projects in Android Studio [duplicate]
I have two separate Android projects: a camera project and an image editing project. I want to create a new parent project that includes both of these projects and allows them to start independently. ...
0
votes
0
answers
21
views
How easy would it be to build a native android app with Kotlin and then use the same code with Kotlin multiplatform to allow it to be an iOS app too? [closed]
Normally when trying to build cross platform apps people use frameworks like flutter or react native. However my idea is to build the app native on android with compose ( so the app harnesses the ...
0
votes
0
answers
45
views
Problem with Spring Boot,mysql and Docker
I have a spring boot application that has a connection to the mysql database, when I try to dockerize it and create the image whenever the application image will run these logs
2024-07-24 17:45:44 ...
0
votes
0
answers
15
views
Springboot + MCerror: No auto configuration classes found in META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
I’m trying to run Spring Boot inside a Minecraft plugin. When I use the main function in IntelliJ to get and print an entity, it works fine. However, when I start the application from the JAR file on ...
0
votes
0
answers
20
views
Google Health Connect integration in Java project issues
I am trying to integrate Google Health Connect APIs into android native app written in Java in order to track step count however I am having issues. For some reason I am having hard time integrating ...
-3
votes
0
answers
26
views
White horizontal line appears on top from splash scene to main scene android [closed]
Added a picture a white horizontal line appears while transition between scenes
This is a gaming app which is built using cocos 2dx v3
Tried to handle hide status bar method but it is not working .
...
0
votes
1
answer
25
views
How would one create a layer list drawable in Jetpack Compose?
layer list drawable image
The above was drawn using layer-list.
<layer-list>
<item
android:width="100dp"
android:height="30dp">
<shape ...
0
votes
1
answer
14
views
Execution of Gradle Tasks and find out why are they executed
I'm currently doing a Udemy Course to learn Kotlin and I've a Question about Gradle and Tasks. I've tried HILT and had to add kapt to my Project (empty project with jetpack-compose).
My app/build....
0
votes
0
answers
39
views
Difficulties upgrading old project to Android 14
I am experiencing tremendous difficulties upgrading a project to Android 14.
A little background into the project.
The project currently cannot be upgraded past Java 15 , API Level 33 and Gradle 7.0.2
...
1
vote
0
answers
32
views
Android: OnNewIntent overrides nothing
After recent updates to several libraries in my gradle, when I built my project, it gives me these two errors:
1. 'OnNewIntent' overrides nothing
2. 'dispatchKeyEvent' overrides nothing
I see that ...
0
votes
1
answer
15
views
Could not get unknown property 'kotlin_version' Flutter packages
after updating Flutter I'm getting this error with almost every package I add to the project. For this example we'll use the permission_handler package.
FAILURE: Build failed with an exception.
* ...
0
votes
0
answers
20
views
AIDE project initialization shows up with errors
When I try to sync the project, I get:
java.lang.IllegalArgumentException: Unsupported class file major version 65
Caused by: BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_'...
0
votes
0
answers
29
views
How can I open another window from the same app in android?
I want to open another window from my own app when I start a new activity like Meta Messenger does when someone calls.
I uploaded my screenshot.
I tried this to open a new window like Messenger does ...