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
  • l

    leandro

    11/23/2020, 5:40 PM
    Anyone having issues with the new
    kotlin-parcelizer
    plugin in 1.4.20 and
    ParcelCreator
    lint rule?
    :yes: 1
    z
    • 2
    • 10
  • s

    Slackbot

    11/24/2020, 9:26 AM
    This message was deleted.
    g
    v
    • 3
    • 2
  • c

    Corey Lanier

    11/25/2020, 1:17 AM
    Is there anyway to change where the design split is oriented on the window? I was wanting to rotate my monitor back to vertical at some point, the reason i switched back to horizontal was because it was a pain to use split view because i could never get the design split to be underneath the code. This is how it currently looks.
    d
    • 2
    • 2
  • c

    Colton Idle

    11/25/2020, 2:13 AM
    My android builds take long, but it would be nice if there was a sound that "dinged" when my build was done. Does anyone know of any AS/Intellij plugin that does this?
    g
    e
    • 3
    • 6
  • a

    aipok

    11/25/2020, 9:59 AM
    Does anyone already upgraded project to Kotlin 1.4.20? Any known issues with libraries compatibility or anything that needs attention?
    c
    r
    s
    • 4
    • 3
  • z

    ziv kesten

    11/25/2020, 10:14 AM
    It has been a while since i had to do this but i need to pass some data from a forground service back to activity before the service closes. I used to do that using LocalBroadcastManager. Is there a newer way to do that in kotlin? with flows or other types of streams?
    :stackoverflow: 2
    o
    • 2
    • 3
  • k

    kobby

    11/25/2020, 12:29 PM
    What DateTime libraries are recommended for building a KMM app?
    g
    • 2
    • 2
  • k

    kobby

    11/25/2020, 12:32 PM
    For some reason java imports don't work in commonMain
    v
    • 2
    • 2
  • d

    diego-gomez-olvera

    11/25/2020, 1:33 PM
    What do you think about using default values to enable API users define vertical/horizontal dimensions but also specific sides?
    fun withMargins(
        @Px horizontal: Int = 0,
        @Px vertical: Int = 0,
        @Px start: Int = horizontal,
        @Px top: Int = vertical,
        @Px end: Int = horizontal,
        @Px bottom: Int = vertical
    ) {
     // Operation   
    }
    b
    m
    • 3
    • 7
  • m

    Mohamed Ibrahim

    11/25/2020, 7:18 PM
    Is there a way to get a Circular Reveal Transition between Two fragments using navigation component?
    :stackoverflow: 3
    d
    • 2
    • 1
  • s

    Slackbot

    11/26/2020, 5:53 AM
    This message was deleted.
    :google: 1
    u
    • 2
    • 1
  • l

    luke_c

    11/26/2020, 11:00 AM
    Hi everyone, we have a LifecycleObserver, which has an onCreate and onStart function. Both functions call suspend functions, so we are passing a CoroutineScope to the LifecycleObserver Is there any way we can guarantee that the suspend onCreate function runs to completion before the onStart? Do we need to use runBlocking?
    r
    g
    t
    • 4
    • 11
  • m

    Michal Havryluk

    11/26/2020, 5:53 PM
    Hello everyone, we see huge build performance hit just because of updating from 1.4.10 to 1.4.20 in execution phase of the build. The number of times retrieved cache etc. seems the same. Almost each module just takes sometimes 10 times more time to compile. Any hint where to look? Thanks Gradle 6.7, Android Gradle plugin 4.1.1
    org.gradle.parallel=true
    kotlin.parallel.tasks.in.project=true
    org.gradle.caching=true
    kapt.incremental.apt=true
    android.enableBuildCache=true
    kapt.use.worker.api=true
    android.injected.testOnly=false
    org.gradle.vfs.watch=true
    android.useAndroidX=true
    android.enableJetifier=false
    k
    • 2
    • 10
  • n

    Ningappa Moodi

    11/27/2020, 1:33 AM
    How to get context in Adapter ? is it safe to get context from View/ViewGroup ?
    :stackoverflow: 2
    f
    s
    • 3
    • 2
  • m

    Mark

    11/27/2020, 7:01 AM
    Just about to dive into updating my app to use Google Play Billing 3 with coroutines. Before I do, is there anything to note (e.g. recommended 3rd party wrapper, best practices, gotchas etc) or just to follow the official docs? Currently looking at following this official sample (but swapping out LiveData for Flow): https://github.com/android/play-billing-samples/tree/master/ClassyTaxiAppKotlin
    d
    • 2
    • 2
  • r

    Rafs

    11/27/2020, 5:43 PM
    Is there a better way of writing this?
    loadFavoriteStations()
    returns a
    Flow<List<T>>
    The first
    map
    gives me a
    List<T>
    that I need to map hence the nested
    map
    calls.
    a
    d
    +2
    • 5
    • 8
  • r

    Roshan P Varghese

    11/29/2020, 3:50 PM
    I'm trying to consume a boolean from Proto DataStore as an observable StateFlow but couldn't. #StateFlow
    val isLoggedIn: StateFlow<Boolean> = mainRepository.userPreferencesFlow.map { it.isLoggedIn }.stateIn(viewModelScope )
    The above code gives me the error: "Suspend function 'stateIn' should be called only from a coroutine or another suspend function" I could do it with LiveData like below. #LiveData
    val isLoggedInLiveData: LiveData<Boolean> =
        mainRepository.userPreferencesFlow.map { userPreferences ->
            userPreferences.isLoggedIn
        }.asLiveData()
    Can anyone suggest an equivalent code for StateFlow? ``````
    o
    m
    +2
    • 5
    • 5
  • i

    Iqbal Ahmed

    11/30/2020, 7:50 AM
    Is it possible to convert base64 PDF to Image? External libraries are the last priority.
    :stackoverflow: 4
    a
    • 2
    • 2
  • t

    Tony Mykhaylovsky

    11/30/2020, 5:24 PM
    Looking to replicate an iOS app built with SwiftUI. I wish we could use Jetpack Compose for this production app, but since it's still in alpha and even after a stable release, it will take time to become stable. I have considered Flutter, but that means learning Dart, and I'd rather stay with Kotlin and also avoid Cross Platform mobile solutions. I'm trying to do this the right way for the long-term. What's a good place to start learning Android Kotlin development? Found this course: https://www.udemy.com/course/android-oreo-kotlin-app-masterclass/ Knowing that we'll eventually port to Jetpack Compose, how can I set up and develop the project properly from the get-go? Your advice will be valuable - THANK YOU
    o
    c
    • 3
    • 3
  • c

    Corey Lanier

    12/01/2020, 2:18 AM
    I’m using a
    PagerSnapHelper
    to snap a CardView within my RecyclerView to the screen, and that works great. However, I’m trying to get the index of the current position on screen so that when I reach the end of the list of cards, i can run a pagination request to my API to receive the next set of data to attach to the recycler. Is there a good way to manage doing this? EDIT: No, telling me to Slack Overflow/Google it doesn’t make you a better developer (I already tried them). It just makes you an asshole.
    :google: 2
    :stackoverflow: 2
    o
    j
    • 3
    • 2
  • j

    jaran

    12/01/2020, 1:32 PM
    Anyone have an idea how I can achieve this background for an EditText using a drawable XML file? Wondering if it's possible at all. There should be a 4dp corner radius and a bottom stroke that is 2dp thick.
    :stackoverflow: 3
    :kotlin-intensifies: 2
    :google: 2
    r
    j
    u
    • 4
    • 12
  • s

    Sivan

    12/01/2020, 2:24 PM
    Hey guys! So when I send a request to resend the OTP after the timeout using FirebasePhoneAuth, I get the exact same OTP again. I'm looking for a way to resend a NEW otp when the user clicks on "Re-send OTP" button. Is this an expected behavior? If yes, is there a work around for this? I feel generating a brand new OTP code each time is more secure.
    :google: 1
    :stackoverflow: 3
    u
    • 2
    • 1
  • a

    Andy Gibel

    12/01/2020, 9:48 PM
    Does anyone have strong opinions on SimpleStack vs Jetpack navigation? Seems the more I read, nav components are pretty underwhelming and full of caveats especially with multi module projects
    i
    l
    • 3
    • 3
  • t

    tylerwilson

    12/01/2020, 10:27 PM
    Not sure where else to put this. It is Android Studio, so this seems right. This looks odd:
    👍 1
    i
    g
    • 3
    • 9
  • j

    João Rodrigues

    12/02/2020, 1:20 PM
    Hey everyone 👋 is there a multiplatform specific channel?
    m
    m
    z
    • 4
    • 5
  • r

    Ricardo C.

    12/02/2020, 5:04 PM
    Is it safe to use
    Resources.getSystem()
    to obtain the density for dp to px conversions? Could density “config change”?
    val Int.dp: Int
        get() = (this / Resources.getSystem().displayMetrics.density).toInt()
    
    val Int.px: Int
        get() = (this * Resources.getSystem().displayMetrics.density).toInt()
    r
    m
    • 3
    • 6
  • j

    João Gonçalves

    12/02/2020, 5:49 PM
    hey folks, am I missing something or was kotlin-gradle-plugin 1.3.50 removed from maven repos? 🤔 I’m currently bumping on build errors with:
    A problem occurred configuring root project 'android'.
    > Could not resolve all artifacts for configuration ':classpath'.
       > Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50.
         Searched in the following locations:
           - <https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom>
           - <https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom>
    Anyone else experiencing this?
    v
    • 2
    • 3
  • s

    san

    12/03/2020, 3:59 AM
    could any one tell how to implement view binding in recycler view adapter class
    :google: 1
    :stackoverflow: 1
    u
    j
    • 3
    • 12
  • s

    Sam

    12/03/2020, 4:58 AM
    Hello everyone, I have been looking for solution load more/reach on top and bottom in RecyclerView. So Has anyone ever worked on this?
    :stackoverflow: 1
    :google: 1
    j
    k
    e
    • 4
    • 6
  • k

    Klaas Kabini

    12/03/2020, 10:47 AM
    How do you make RecyclerView items not overlap when being scaled up. I want them to respect the vertical spacing of 16dp even when scaled up. Right now the problem I am facing is that the items overlaps each other when you zoom in.
    :stackoverflow: 2
    :google: 3
    s
    • 2
    • 3
Powered by Linen
Title
k

Klaas Kabini

12/03/2020, 10:47 AM
How do you make RecyclerView items not overlap when being scaled up. I want them to respect the vertical spacing of 16dp even when scaled up. Right now the problem I am facing is that the items overlaps each other when you zoom in.
:stackoverflow: 2
:google: 3
s

Shalom Halbert

12/03/2020, 11:50 AM
What is happenning in the RecyclerView to allow zooming in?
k

Klaas Kabini

12/03/2020, 11:54 AM
@Shalom Halbert I scale the current child using setScaleX and setScaleY based on scale factor
s

Shalom Halbert

12/03/2020, 11:57 AM
Unfortunately, it’s something I’m unacquainted with
View count: 6