https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
stackoverflow
  • u

    user

    07/15/2022, 5:31 PM
    java.lang.RuntimeException: cannot find implementation for com.example.laptopsdb.AppDatabase. AppDatabase_Impl does not exist (July 2022) Yes I have already tried some old guides, I described it below. I created new project for Room Database in Kotlin Android. I followed the official google documentation for it. https://developer.android.com/training/data-storage/room If I follow as per documentation I get error java.lang.RuntimeException: cannot find implementation for com.example.laptopsdb.AppDatabase. AppDatabase_Impl does not...
  • u

    user

    07/15/2022, 6:11 PM
    How to Animate An Image in Jetpack Compose? I haven't seen any posts that are searching for what I want. I simply want to animate an icon to go across the screen. Just an Image, to go left to right upon showing the composable. So far I've only seen that Animations are launched with a button click or when something happens, but I want this Animation to launch when the Composable in first in view
  • u

    user

    07/15/2022, 6:11 PM
    How to make a ListView in a Fragment display my data (Android)? I'm working on my Android app and have a Fragment FragmentBlank with TextView messages_list in it. In the FragmentBlank.kt I wrote these 5 lines: override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { val view = inflater.inflate(R.layout.fragment_blank, container, false) val listOfMessages = view.findViewById(R.id.messages_list) val values = arrayOf("Android", "iPhone", "WindowsMobile", "Blackberry", "WebOS",...
  • u

    user

    07/15/2022, 6:31 PM
    Overwhelmed by layouts, what are my alternatives to make a layout like this, but dynamic number of items?

    https://i.stack.imgur.com/n4RAy.pngâ–¾

    I'm a flutter user trying out kotlin dev first time, but im kinda confused what the best alternatives for this type of layouts are. I understand that I use recyclerview for a dynamic number of items. And since theres two dynamic ones (one for number of sets, one for each exercise). Do I use two nested recyclerviews?
  • u

    user

    07/15/2022, 6:31 PM
    Kotlin Gradle plugin need update Hello for every one I have some problems in vscode i need solve this problem [enter image description here][1] [1]:

    https://i.stack.imgur.com/NVgB5.pngâ–¾

    this is real estate app when i run this app i have get this msg i need to solve this problem here is build.gradle file need to upgrade file def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader ->...
  • u

    user

    07/15/2022, 7:11 PM
    how to make many ViewModelFactory in kodein with kotlin i use kodein principle in mvvm to set my ViewModelFactory with repositories class AddSpendApplication: Application(), KodeinAware { override val kodein: Kodein = Kodein.lazy { import(androidXModule(this@AddSpendApplication)) bind() from singleton { PersonalAccountingDateBase(instance()) } bind() from singleton { AddSpendRepository(instance()) } bind() from provider { AddSpendViewModelFactory(instance()) } }} so when i have many ViewModel in my app , i should make...
  • u

    user

    07/15/2022, 7:31 PM
    Kotlin. Data class: how to update one of the parameters? I have data class. For example: data class Test( val data: String, val data2: String ) Suppose I have a need to change one of the parameters of my data class. For this I will write the following code: var test = Test(data = "data", data2 = "data2") test = test.copy(data = "new_data") But at the same time, I can make a parameter var and change it directly: data class Test( var data: String, val data2: String ) var test =...
  • u

    user

    07/15/2022, 8:11 PM
    How to block adult websites in android programatically I am developing a parental control Android app with Java. I want to block all adult websites. But I don't know how to do it! Should I have a database of adult websites? Or is there a website that will give me an api to check for inappropriate websites?
  • u

    user

    07/15/2022, 8:31 PM
    Validation of blocking calls within non-blocking coroutine contexts in Kotlin We have semantic validations to prevent calling a suspend function from within a blocking non-coroutine context. Is there a way I can mark a function as blocking to at least warn that you are about to call a blocking function? If so, is there a way to semantically or at runtime to indicate that the current dispatcher used by the coroutine context is intended for non-blocking purposes and that you are about to call that function which you have marked as potentially blocking?
  • u

    user

    07/15/2022, 8:31 PM
    How to animate the next item smoothly when expanding the previous item in recyclerview I'm making an expandable nested recyclerview. I have implemented both a parent recycler view and a child(nested) recycler view, but I would like the next item to be pushed out more smoothly when the previous item is expanded. I'll show you an example image. First what I want.

    https://i.stack.imgur.com/X1dA8.gifâ–¾

    But what I made.

    https://i.stack.imgur.com/yM5y6.gifâ–¾

    If you look at the GIF file, you won't notice...
  • u

    user

    07/15/2022, 8:51 PM
    JetpackCompose Page crashes after splashscreen [closed] I am developing an application with jetpack compose. The interface was working, today I wrote the necessary codes to make transactions using the room database. After adding the database codes to the relevant fields in the panel page, the application crashes after splashscreen. I couldn't find the error. Since the codes are long, I share the codes on the github page. All Folder <a href="https://github.com/imonursahin/ibansfer-with-kotlin/tree/main/app/src/main/java/com/example/ibanshare"...
  • u

    user

    07/15/2022, 9:31 PM
    Notes sound recognition (Piano) I create Android app to recognize all of piano notes. Is there any library to help me with that or should I use some kind of alghoritm or some other way to realize this functionality?
  • u

    user

    07/15/2022, 9:31 PM
    Why can I not delegate to a parameter in a Kotlin value class? I can delegate to a contructor parameter in a class class SerialNumber(val value: String) : CharSequence by value { init { require(value.isNotBlank()) } } but if I make the class a value class @JvmInline value class SerialNumber(val value: String) : CharSequence by value { init { require(value.isNotBlank()) } } then the compiler says "Value class cannot implement an interface by delegation if expression is not a parameter" As far as I can see value is a...
  • u

    user

    07/15/2022, 9:51 PM
    Kotlin Concurrency againts Goroutine, Task, CompletableFuture People always show the same example when I read articles about concurrency in kotlin coroutine or golang goroutine. Create 100_000 Threads in Java or C#, ooopps Stackoverflow. Yes. but anyone Who uses directly Thread classes in Java or C#? In java and C#, There are thread pools for CompletableFuture and Task. When We try to create 100_000 Task or CompletableFuture, We can do that easily with ExecuterService/ForkJoinPool or dotnet DefaultThread Pool. They will reuse the threads. If there is no...
  • u

    user

    07/15/2022, 10:21 PM
    Translate animation not moving smoothly I am trying to make a card game, I use translate animation to move the cards when user plays. It came to my notice that the animation works smoothly for device with higher android versions and performs poorly and Jacky on android 5.0 down. How can I make the animation moves smoothly on all devices? Below is my method used for move the cards. public void Move_Card_To_PlayArea(){ Move_Card_Animation =new TranslateAnimation(0, (float) move_card_getX,0,(float) move_card_getY);...
  • u

    user

    07/15/2022, 10:21 PM
    Kotlin. Mockk: Missing mocked calls inside every I'm using mockk library fo testing my business logic. I have interactor which I want to test. My interactor retrieve in constructor data class. Fox example: data class Test( var data1: Data1? = null, var data2: Data2? = null, var data3: Data3? = null // etc ) data class Data1(var nestedData: String) data class Data2(var test: String) data class Data3(var test: String) Inside my test I'm trying to make partial mocking: @MockK private...
  • u

    user

    07/15/2022, 10:41 PM
    Java 9 module cannot access files in same module The whole project can be viewed here. I have the following minimal demo project: package com.example.demo import io.swagger.annotations.Api @Api(tags = [API_NAME]) class DemoClass const val API_NAME = "demo" fun main() = println("Hello World!") Works perfectly fine as is. However now I want to add the Java 9 module system. I add a module-info.java under src/main/kotlin with this content: module com.example.demo...
  • u

    user

    07/15/2022, 11:21 PM
    Mock boolean property using Mockk is not working I'm using Mockk and I want to test a MediatorLiveData that depends of some boolean properties of the class. I was using mockkConstructor(Boolean::class) but suddenly a warning appears on the console log and all the test cases fails (I'm not sure but seems to be happening after updating the Kotlin version) WARNING: Non instrumentable classes(skipped): boolean Class to test class Testeando { var testBool = false fun test() : Boolean { return testBool } } This is the...
  • u

    user

    07/15/2022, 11:21 PM
    JavaFX 3d : Weird clipping or false z-buffer i guess So, I'm working on my little project for perlin-noise generated meshes and all works fine, except the rendering. I don't know what I am doing wrong. From the one side (looking in +z direction) everything seems totally fine, but from the other side (looking in -z direction) it just looks weird. Demonstration Video: (Sorry for the bad quality) <a href="https://drive.google.com/file/d/1q7tsSzVr4VVw4Tr5Y-WNTdlO5wo6DoKg/view?usp=sharing" rel="nofollow...
  • u

    user

    07/16/2022, 12:01 AM
    Using Transaction in PostConstruct I'm using Hibernate with Panache and I need to add a user when the application starts. For that, I'm annotating my bean with @Startup and then I have a method with the annotation @PostConstruct. Currently, I'm using the following code: @Startup @ApplicationScoped class AuthService { @Inject lateinit var userRepository: UserRepository @PostConstruct private fun init() { logger.info("Creating admin user") val user = User( "Admin", ADMIN_NAME,...
  • u

    user

    07/16/2022, 12:21 AM
    recreate activity with animation not work Change all my activity to ViewModel to keep the UI data because I need to recreate the activity when switching to dark mode or applying a theme. I created the fade in and fade out animations to add them, but I can't get it. I already tried recreate() overridePendingTransition(in, out) finish() overridePendingTransition(in, out) startActivity(intent) overridePendingTransition(in, out) Even if it is not with animation, when recreating the activity the transition is very different from when,...
  • u

    user

    07/16/2022, 12:41 AM
    Can you create a Custom Conditional Expression in Kotlin? Currently I'm trying to write the equivalent of a custom conditional block or a non-extension version of the takeIf function that carries through things like nullability checks ect... and having difficulty doing so. The motivation behind this is that at my company we have a lot of use cases that look like either return if (condition) { // Code block (can often be large enough to distort what the else belongs to at a glance) } else { null } or something that has...
  • u

    user

    07/16/2022, 3:01 AM
    try-catch-finally as expression I am stuck with an exercise on hyperskill.org at try-catch-finally exception(exercise: Parting words). Try-catch-finally should be used as an expression. In the "try" block an input string is required to check if it consists of two words separated by a space. If not(there's only one word given), an exception is thrown in the "catch" block. Otherwise the code in the "try" block should be evaluated. How can it be achived? fun pepTalk(name: String) : String { val array = name.split("...
  • u

    user

    07/16/2022, 4:21 AM
    Todo List Android App -- Clean up code -- Espresso and Unit Tests Trying to improve this code and separate the business logic as much as possible. I am feeling kind of lost lol. Any advice on how to test this app and clean up the code would be very appreciated. I don't want to post all of the code on here so I will link my repository on GitHub. Really need this explained simply. Thank you for your time!! link -> https://github.com/sammorton11/NotesApp class AddEditNoteActivity :...
  • u

    user

    07/16/2022, 5:01 AM
    android: Notify a fragment when something happened in another fragment I Built a fragment (using jetpack compose to built the views) and in this fragment I have a button. every time this button was clicked, I want to notify another fragment to do something. How can I do that? I use MVVM and MVI design patterns. Thanks.
  • u

    user

    07/16/2022, 6:41 AM
    Kotlin/JS build is empty In the following project: https://github.com/MarcinMoskala/AnkiMarkdown When I build or push a package to NPM, it seems empty. No binary code. I do export a single class: https://github.com/MarcinMoskala/AnkiMarkdown/blob/master/src/jsMain/kotlin/AnkiConnectorJs.kt
  • u

    user

    07/16/2022, 7:01 AM
    How do I split a List of objects by a delimiter in Kotlin? I have a List of objects I want to split by a delimiter into sublists, e.g: val tokens = listOf( Token(name = "lorem", val = "ipsum"), Token(name = "dolor", val = "sit"), Token(name = "newline", val = "\n"), Token(name = "amet", val = "consectetur") ) The delimiter should be any Token whose name is "newline", so after the split, tokens should become: listOf( listOf( Token(name = "lorem", val = "ipsum"), Token(name = "dolor", val = "sit") ),...
  • u

    user

    07/16/2022, 7:41 AM
    How to prevent the user from entering two dots in a text field jetpack compose I have a Text Field in android jetpack compose, which used to get number from user including floating points. How to prevent user from entering 2 dots in the input. For Eg: Number should be 56.54,.266, 367.5 Should not be like this: 34.3.5
  • u

    user

    07/16/2022, 8:01 AM
    Get card verification method from track2 of credit card I am dealing with a problem, there is no information in web about how to get card verification method from track2 of credit card. I need to check if there is none/PIN required or signature needed. Anyone know the solution?
  • u

    user

    07/16/2022, 8:01 AM
    How to keep efficiently continuous memory in RAM for Kotlin Multiplatform mobile project A mobile app receives series of 4 bytes long packets. There can be about ~1M of those packets received in one session. The app can analyse them once all packets are received, so there is a need to store them somehow. I wonder what is the best approach in terms of memory size efficiency for Kotlin Multiplatform Mobile project. I considered: Common implementation for Android and iOS and use: ByteArray List - keep 2 packets in the biggest primitive - Long (8B) to reduce number of internal items...
Powered by Linen
Title
u

user

07/16/2022, 8:01 AM
How to keep efficiently continuous memory in RAM for Kotlin Multiplatform mobile project A mobile app receives series of 4 bytes long packets. There can be about ~1M of those packets received in one session. The app can analyse them once all packets are received, so there is a need to store them somehow. I wonder what is the best approach in terms of memory size efficiency for Kotlin Multiplatform Mobile project. I considered: Common implementation for Android and iOS and use: ByteArray List - keep 2 packets in the biggest primitive - Long (8B) to reduce number of internal items...
View count: 13