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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
5 views

Kotlin incompatibility problem when adding ads/billing to older Android app

I'm working on a legacy Android project which is working fine on the latest Android API 33 (Gradle version 8). I get a problem when I'm trying to add ads/billing by including the following imports in ...
ZP007's user avatar
  • 592
0 votes
0 answers
4 views

How to prevent VS Code from changing svg-processor files

How do I prevent (I assume) VS Code from constantly changing the 4 files in svg-processor? Adding it to .gitignore would maybe be a solution but won't it add this to everyone's .gitignore since I'm ...
Chefski's user avatar
  • 31
0 votes
0 answers
10 views

Emitting on upstream flow inside onSubscription is not collected - despite what documentation says

The documentation for SharedFlow<T>.onSubscription says: (emphasis mine) Returns a flow that invokes the given action after this shared flow starts to be collected (after the subscription is ...
Simon Forsberg's user avatar
0 votes
0 answers
4 views

i can not use intent to another activity, every time i have null, where problem?

`enter image description here enter image description here enter image description here in AuthActivity im create userLogin, after if we can auth, im send in BasketActivity my login, i wanna do my ...
tryouq's user avatar
  • 1
0 votes
0 answers
6 views

Retrofit Exception: java.lang.IllegalStateException: Already executed [duplicate]

I developed an Android Apps with retrofit which is used to access Django REST API. class ListAdapter<T : ViewBinding>(private val user: String, private val chafingDishData: List<ChafingDish&...
Jingda's user avatar
  • 43
0 votes
0 answers
16 views

Center a recyclerView card item in a specific view after scrolling

I am trying to make a slot game with a vertical RecyclerView and a button, when the user hit that button, it automatically scrolls the list. Meanwhile, in my main activity XML, I have a view with a ...
widy 's user avatar
0 votes
0 answers
5 views

Add react native module inside android kotlin app

I am trying to add a new React native module to an existing android application. I already was able to make the android app open the react native activity following the guide that React Native ...
Bruno Ramos's user avatar
1 vote
1 answer
24 views

In Jetpack Compose, how can you check to see if a screen has re-composed?

I want to be able to set accessibility focus on a Text object, but only once it becomes visible (through mutable state boolean that is remembered). This means that the screen needs to finish re-...
user22376410's user avatar
0 votes
0 answers
10 views

My cutsom bottom navigation has lag and jump frame when I switch between items

I created a custom bottom navigation and when I want navigate from home fragment to plan fragment occurring lag and jump frame but on the contrary is smoother(probably because I used more elements in ...
hassan golestani's user avatar
0 votes
0 answers
5 views

I cant add onclicklistener on a constaintlayout

package com.example.nagaduserapp.Fragment import android.content.Intent import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import ...
Sayem's user avatar
  • 1
0 votes
0 answers
12 views

java.lang.ClassNotFoundException running Kotlin jar library

I am creating REST API for ClamAV https://hub.docker.com/r/clamav/clamav and I try to use java clamav-client https://github.com/cdarras/clamav-client for this purpose. I have built clamav-client and ...
Eduard Nickel's user avatar
0 votes
0 answers
3 views

How to create an infinite surface in Android?

I want to create an app with many objects on a surface, and you can move through the surface in any direction, also zoom in and out. Like for example Miro or Figma. Is it possible with some libraries ...
Dmitry Sukhov's user avatar
1 vote
1 answer
20 views

What is the difference between "x is T" and "(x as? T) != null"?

In Kotlin, when writing a generic, non-inline function, x is T throws a compiler error due to type erasure. fun <T> example(foo: Any, bar: T) { if (foo is T) { // compile error // ......
Adam Burley's user avatar
  • 5,696
0 votes
0 answers
13 views

multithreading in kotlin - running some part of a function concurrently

I have this function i want the part were list 'values' is being created to run in threads or concurrently. I want to make sure that the function waits for values list while equating as many fields as ...
Youssef Kandil's user avatar
0 votes
0 answers
8 views

How can I secure my Android app against unauthorized modifications or APK patching using PackageManager signatures?

I would like to ask a question regarding Unauthorized Application Modification or APK Patching in the context of Android. How can I secure my application against this threat? Is using PackageManager ...
Takeshi567's user avatar
0 votes
1 answer
12 views

Retrieving data from DataStore using runBlocking

Would it be a good approach to use runBlocking in following implementation? Would it cause UI to be laggy? I use it all in my viewModel. lateinit var centralReturnsPaging: Flow<PagingData<...
Cuyer's user avatar
  • 107
0 votes
0 answers
6 views

How can I fix the error RECEIVER_EXPORTED

I encountered the error; java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.lyricsify/com.example.lyricsify.MainActivity}: java.lang.SecurityException: com.example....
Slim Shady's user avatar
0 votes
0 answers
19 views

KotlinJS React - Context and Reducer

I am trying to use Context and Reducer, but I just cannot get it to work for hours. I followed this Tutorial: https://react.dev/learn/scaling-up-with-reducer-and-context A little stripped down and ...
Splitframe's user avatar
0 votes
1 answer
29 views

Analogue match parent in compose

Is there any analog of match parent in compose? How can I make the red and blue text the same height if the blue text is shorter? I want to ensure that the remaining part is filled with blue to the ...
TOvchinnikova's user avatar
0 votes
0 answers
32 views

Google In-App Review - Android native Not working

I am currently working on a requirement to display a In-App review popup within the app for user reviews. Unfortunately, I am encountering difficulties in getting the In-App Review popup window to ...
Shubhank Gupta's user avatar
0 votes
0 answers
14 views

createBitmap is not working in DialogFragment Kotlin

I am trying to take capture the specific view in DialogFragment But createBitmap is giving me empty value please help me out how to fix these issue xml <androidx.constraintlayout.widget....
Atul Dhanuka's user avatar
  • 1,453
1 vote
1 answer
43 views

Giving completion instructions ahead of calling send with MockProducer

I have the following code (Obviously made as an example): class RandomClass( val producer: Producer<String, String> ) { fun randomFunction(): Boolean { // Using .get() because I want to ...
Stene's user avatar
  • 157
0 votes
0 answers
6 views

Rotate the appWidgetIds continuously with time

I am creating the clock widget in my app. I want to rotate the needle with time. I have tried different ways but have not been successful yet. If I don't apply any method to rotate the widget appears [...
Iqra Riaz's user avatar
0 votes
1 answer
28 views

why is the gradle syntax of my projects different from that of everyone else's?

in my kotlin android projects the gradle syntax must look like this way, and doesn't support many of the features/lines posted around in tutorials and other answers here, why? in my projects, the ...
M.KH's user avatar
  • 270
0 votes
0 answers
20 views

Invoke Kotlin suspended function inside reactive stream

I use Spring Boot app and Kotlin lang. I want to receive messages though the reactive Kafka consumer, and then pass these messages to the suspended Kotlin function and use coroutines there, then get ...
user2625402's user avatar
0 votes
1 answer
9 views

Create another module in Compose Multiplatform Project

I'm currently building a project with Compose Multiplatform, and I'm wondering to make this project structured with multi-module clean architecture. Here's my current modules: I'm looking for adding :...
Raka M.A's user avatar
  • 119
0 votes
0 answers
11 views

Multiple usb-devices in device-filter.xml

I was wondering if it's possible to have multiple usb-devices in the device-filter.xml file. I have different product-id's for each usb-device. Although I can do this in my code like this: if (dev....
mohammed_sajid's user avatar
0 votes
0 answers
9 views

Best option to flatten and transform a nested array in kotlin?

I want to convert 1 complex model class into a simple model class in my project. Complex model class sample is as follows. Books (id, title,content) Content (texts[],photos[]) Photo(item) Item (url) ...
Droid's user avatar
  • 77
0 votes
0 answers
18 views

Application is reboot when revoking application permissions

When I open settings from within the app and then cancel permission, the app reboots. How can I detect when the app is rebooted?
NDC00's user avatar
  • 11
0 votes
1 answer
19 views

How to underline a Text upon clicking it?

I am trying to get my text displayed by "$item" underlined upon clicking by using onClick. I have used Divider() to create the underline and was trying to assign a default colour = ...
vibe_tribe's user avatar
0 votes
0 answers
5 views

Why does "android resource linking failed error"?

Android resource linking failed com.example.menuandflexbox.app-mergeDebugResources-35:/layout/activity_signup.xml:195: error: resource drawable/baseline_calendar_month_24 (aka com.example....
Hasnain Gujjar's user avatar
0 votes
0 answers
22 views

I generated a disparity map using OpenCV's Stereo Vision, but all I see is a black screen

android screen image The top left is the left camera, the top right is the right camera, the bottom left is the left camera converted to gray, and the bottom right is the disparity view. The Python ...
AKA _Aptenia's user avatar
0 votes
0 answers
10 views

Player controls not showing up in Android Auto

I have setup the mediasession, along with the playbackstate, metadata and callback. mediaSession = MediaSessionCompat(this, "MusicService") .apply { setSessionActivity(...
Ian Lee's user avatar
  • 91
0 votes
0 answers
14 views

Keyboard when lose focus BasicTextField Android Compose

I would like to know if it is possible that when a BasicTextField has the focus and the keyboard is up, when I put it after an action of a button for example, enabled to false to that BasicTextField, ...
RubenD's user avatar
  • 1
0 votes
1 answer
36 views

Why my status bar is not keeping existing color?

I was added this line of code in Main Activity, i'm using single activity architecuture WindowCompat.setDecorFitsSystemWindows(window, false) val windows = (LocalView.current.parent as? ...
Yuba's user avatar
  • 87
0 votes
0 answers
11 views

Want to customize zip file property in Android/ kotlin

I am creating zip file in android by code at run time and wanted to customized or add new property-value to zip file during the file creation or later. I am able to create zip file by code but not ...
Niraj's user avatar
  • 1
0 votes
0 answers
22 views

Textinputlayout space between hint and edittext

Is there some way to add space between hint and edittext? My edittext is multiline and when theres to much text and lines hint can overlap edittext. I want additional spacing between hint and ...
Khan's user avatar
  • 11
0 votes
1 answer
14 views

Is there a way to achieve a mutually recursive ADT in Kotlin?

I am currently trying to learn about language grammar and parsers, and trying to implement stuff in Kotlin as I go. I have a small description here in Backus–Naur form for the definition of type: <...
GeekOverdose's user avatar
1 vote
1 answer
33 views

Updating a TextView closes Spinner

I have a problem that seems simple, but I've been unable to resolve. I have a normal TextView and a normal Spinner with some items together in a normal ConstraintLayout. Whenever I update the TextView ...
Aloha's user avatar
  • 914
0 votes
0 answers
16 views

function skipping when collecting flow

In my Android app I am trying to retrieve a list of saved locations but one function that is part of fetching that data from the database is just "getting skipped" for lack of a better term. ...
user19334054's user avatar
-2 votes
0 answers
33 views

I need help on Kotlin and Firebase

val store = queryList[position]!!.toObject(Store::class.java) in this code, toObject(Store::class.java) is not working. How can I solve this issue? package com.pos.entity import com.google.firebase....
user22597312's user avatar
0 votes
2 answers
31 views

Kotlin: serialize Float element with 3 decimal places

I have a data class like this: import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.JsonElement @Serializable data class Event( @...
user1443721's user avatar
  • 1,130
0 votes
0 answers
14 views

Following a Kotlin tutorial in Android Studio: androidx.lifecycle.viewmodel.compose.viewModel import gives error

Been learning Kotlin and today I went to check out the "ViewModel and State in Compose" course. In item 6, there's this code: import androidx.lifecycle.viewmodel.compose.viewModel @...
Dharhix's user avatar
0 votes
1 answer
29 views

How can I navigate to a new screen with varied data from a lazy vertical grid in Jetpack Compose?

Subject Section As shown in the above image, I want to navigate to subject screen from this home screen. But I want data of that subject to load into new screen when clicked on each subjects. Right ...
Hari Joshi's user avatar
0 votes
1 answer
43 views

How to add/remove a button in Jetpack Compose while retaining its size

I have a button composable, and I want to hide/show it without affecting the surrounding composables' positions. For example, the following code is used to remove/add the button without making the ...
Matteo Zattera's user avatar
0 votes
1 answer
16 views

title on toolbar not showing up

I created a toolbar that has a title on it but the tile isn't showing. The colors don't clash so I don't know what is the issue. This is my xml code where I have my title and style xml to hold the ...
nia brown's user avatar
0 votes
0 answers
21 views

Preventing com.miui.powerkeeper in android

I have a background application, and it is working like a charm but when I boot my device and call it with broadcast, it is not working because of com.miui.powerkeeper. Here is the error log: E ...
softwarest's user avatar
0 votes
0 answers
6 views

everytime i try to navigate, i navigete to the same activity

can someone please help me? i'm very noob and i'm desperate, i'm trying to do a navigation between 2 activities, i make Intents and startActivity but everytime i press the button it navigates to the ...
all4n's user avatar
  • 1
0 votes
1 answer
36 views

Correct way to check for true value without exiting loop in Kotlin

I'm working on a application in Kotlin that needs to iterate over a range, calling a sub-function for each item. The function then returns a boolean indicating if any of the sub-function calls ...
pbuchheit's user avatar
  • 1,429
0 votes
1 answer
32 views

How to create a @Provides function for a class that have @AssistedInject with android Hilt

So I'm trying to figure out how to create a @Provides function for a class that have @Assisted inject, is it possible or even a good practice? I'm trying to inject a Pager from the android Paging ...
Gibran Lyra's user avatar

1
2 3 4 5
1861