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
android
  • s

    Sergio C.

    11/15/2022, 6:12 PM
    Hi everyone, Can we use Kotlin sealed classes in Java with switch statements? I want to switch on all the branches from Java.
    e
    • 2
    • 2
  • a

    Adam Brown

    11/15/2022, 10:48 PM
    so
    WorkManager
    Foreground Workers can run for > 10 minutes, but the documentation mentions that Expedited jobs (which also present a foreground notification) should only run for "a few minutes". Does anyone know if this is enforced? Is there a 3 minute or similar time limit on Expedited Workers? I would like to expedite a long running Worker as it's initiated in response to a user interaction, but the Worker may have to run for > 10 minutes
    j
    • 2
    • 1
  • s

    stack

    11/16/2022, 8:47 AM
    Hi guys, I'm using a compose TextField I want to paste text at the beginning of a word But when i long press cursor, the word after cursor is selected instead of exposing the context menu how do i do?
    b
    • 2
    • 2
  • s

    Slackbot

    11/17/2022, 6:08 AM
    This message was deleted.
  • m

    Massimo Canonico

    11/17/2022, 7:09 AM
    Hi all, it is 2 days that I'm looking for a tutorial (or an easy working example) concerning WorkManager with no luck. All the solutions provided by codelabs and other websites, simple do not work. I wrote to the authors and they tell me that they have to fix bugs (probably this is due to the fact that a code written one year ago needs some updates).
  • m

    Massimo Canonico

    11/17/2022, 7:09 AM
    So, do you have a link with a simple working example, please?
    t
    • 2
    • 42
  • a

    AmrJyniat

    11/17/2022, 8:20 AM
    Can I map a list into two separate lists based on the fields?
    val list = listOf<Pair<Int, Int>>()
    val (firstList, secondList) = ?? //how to do the mapping on the list here
    e
    • 2
    • 5
  • a

    Abdulaziz Mohammed

    11/17/2022, 11:28 AM
    What is differnet between repository and data source?
    j
    k
    m
    • 4
    • 5
  • z

    Zaki Shaikh

    11/17/2022, 12:11 PM
    Does anybody know that how keep PNGs in their appropriate drawable folder by their resolution like drawable, drawable-hd, drawable-xhd and so on because I did put PNGs in wrong folder and getting crashes any documentation for this or other source, thank you.
    m
    • 2
    • 12
  • e

    Eran Boudjnah

    11/17/2022, 7:02 PM
    Hi there 🙂 I'm hoping someone can help. In KMP our project we have a
    debug
    and a
    release
    build types. The app module is a plain Android module. We have a second module that's a KMP module. Every dependency from the KMP module shows in red in the app module. I fixed it by replacing
    androidMain {
        dependsOn(commonMain)
    }
    with
    androidDebug {
        dependsOn(commonMain)
    }
    
    androidRelease {
        dependsOn(commonMain)
    }
    I'm wondering why this works. Is something wrong with my configuration, is this the expected behaviour, or...?
    l
    • 2
    • 16
  • r

    Rafael Costa

    11/17/2022, 7:20 PM
    I'm not sure where to ask this.. but.. can people copy code from android open source project into a library which will also be open source under same licence? Or do we need to take some steps for it? Let's say I want to copy the method
    <http://android.net|android.net>.Uri#encode(String)
    adapt it a little bit maybe use Kotlin as well. I'm terrible at this license stuff 😅
    e
    d
    • 3
    • 5
  • v

    vesp

    11/17/2022, 7:57 PM
    Are there any good repos (code samples works fine as well) on github that will help me understand the difference between
    StateFlow
    and
    SharedFlow
    ? I can't for the life of me understand this concept and when to use one over the other.
    j
    p
    m
    • 4
    • 6
  • g

    Gordon

    11/18/2022, 6:28 AM
    Hi, does using lateint has a performance cost? It does add a condition for every access to variable?
    m
    • 2
    • 1
  • d

    DINESH S

    11/18/2022, 8:44 AM
    Multilanguage made simple. Full working example tutorial. My first blog!! https://medium.com/@fierydinesh/multi-language-support-android-localization-in-app-and-system-settings-change-language-e00957e9c48c
  • s

    Slackbot

    11/18/2022, 10:32 AM
    This message was deleted.
  • a

    Abdulaziz Mohammed

    11/18/2022, 11:02 AM
    If I should redirecting user to browser to give some permissions then back to App with some data from browser, how can I send data from browser to app?
    j
    • 2
    • 2
  • h

    Hyper Nova

    11/18/2022, 2:23 PM
    Hi everyone I am stuck on my project and hoping to get some help on it. So I'm basically working on an app which is somewhat similar to Linkedin but only for my University. So there are two types of profiles one is User and one is Teams So I'm getting error on the Team Screen. So there's a screen where an api call is made and all available teams are listed. Once you click on one of the team card then it opens a new screen with that particular team details. To fetch these team details I have to pass a slug to api endpoint. I'm working in Jetpack Compose and I'm passing the slug through nav args and I make the api call inside the
    Launched Effect.
    So everything is working fine but just the issue is if I try to rapidly switch between team pages then the value of slug is getting glitched. Like it is being passed properly through nav args but Ig the re-composition of screen/composable is causing abnormal changes in slug value. I'm not sure what's the issue and I need help figuring it out.
    j
    • 2
    • 20
  • s

    Slackbot

    11/18/2022, 8:23 PM
    This message was deleted.
  • b

    brian

    11/19/2022, 12:07 PM
    Hello everyone, so is it possible to access a suspend function value inside another non suspend function. I want to access data store value but its return value is a flow. Is there any way I can do this?
    r
    m
    • 3
    • 2
  • b

    brian

    11/19/2022, 12:25 PM
    Currently am using runBlocking but am not sure if that's the right use case
    e
    • 2
    • 4
  • a

    ABRAR WIRYAWAN

    11/20/2022, 2:09 AM
    Hi, i want to ask about kotlin-parcelize. I get "Property would not be serialized into a Parcel" warning on property that is not declared in primary constructor after removing KAE. I find in the docs that all serialized properties should be declared in primary constructor. But the warning didnt exist when im using KAE. Is there any behavior change in new plugin? Is it safe to migrate? This is my class
    @Parcelize
    class SomeParcelableClass(
        var foo: String
    ) : Parcelable {
    
        @Transient
        var bar: String? = null // warning here after removing KAE
    }
    d
    • 2
    • 1
  • k

    KotlinLeaner

    11/21/2022, 9:34 AM
    Hi guys, I want to trigger something after particular time and cancel whenever required. For example I want to count number unlimited after 1 minute and stop whenever I want. Is there way in kotlin? Thanks
    c
    h
    • 3
    • 4
  • a

    AmrJyniat

    11/21/2022, 11:51 AM
    I have a select query in Room DB that collect data from multiple tables, so I created a custom data class suitable for those returned data, now, I want to add an extra attribute to the class without returning it from the query, when I added the
    extraAtt
    I got a compiler error, how do I deal with that?
    data class MyClass(val a: Int, val b: int, val extraAtt: Int)
    ------------
    @Query("select a, b from tableName")
    fun getData(): List<MyClass>
    @ignore
    doesn't help me
    a
    z
    • 3
    • 3
  • k

    Kashismails

    11/21/2022, 4:28 PM
    Is there any kotlin alternative to jsoup?
    m
    • 2
    • 2
  • n

    Naresh

    11/22/2022, 6:31 AM
    can anyone guide me on how to call a login screen in jetpack compose using retrofit MVVM
    g
    • 2
    • 2
  • j

    Jakub Neukirch

    11/22/2022, 7:34 AM
    Is it possible to change gravity of navigation drawer in compose? I would like it to be on the right side of the screen
    a
    • 2
    • 1
  • s

    Slackbot

    11/22/2022, 7:59 AM
    This message was deleted.
  • s

    Slackbot

    11/22/2022, 12:45 PM
    This message was deleted.
  • n

    Nebil

    11/22/2022, 2:04 PM
    I wanna create a dialog for both portrait and landscape mode and I want it at to be at the bottom centre for portrait and left bottom for landscape. I managed to do it with DialogProperties(useplatformdefaultwidth = false) The problem is when I change the orientation the ui breaks sometimes and I cant figure out why.
    k
    • 2
    • 1
  • s

    Slackbot

    11/22/2022, 3:59 PM
    This message was deleted.
Powered by Linen
Title
s

Slackbot

11/22/2022, 3:59 PM
This message was deleted.
View count: 2