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

    Uma Shankar Pathak

    03/25/2021, 10:56 AM
    🔥 🔥 🔥 Getting this crash related to Webview can anyone please help signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) Hide crash
    backtrace:
      #00 pc 00000000034529dc /data/app/com.google.android.webview-vsrMEcv18S4LBJhFw8XnvA==/base.apk!libmonochrome.so (offset 0x2d3000)
    it is  crashing on all android devices. maybe this is bad chrome update rolled out by Google. Can anyone please confirm that please 🙏🏽
    🤦‍♂️ 2
    :not-kotlin: 4
    k
    • 2
    • 3
  • j

    Jimmy

    03/25/2021, 11:45 AM
    any recyclerview expert in this chat? 😄
    a
    • 2
    • 1
  • i

    Ifvwm

    03/25/2021, 1:13 PM
    can I use async do IO in one activity, and bind that Deferred object into a companion object, in another activity to do await for the IO result to update UI?
    a
    j
    +2
    • 5
    • 10
  • s

    Slackbot

    03/25/2021, 8:22 PM
    This message was deleted.
    :stackoverflow: 2
    n
    • 2
    • 1
  • t

    Tiago Nunes

    03/26/2021, 11:18 AM
    Hey everyone, exceptions thrown inside kotlin coroutines aren't being printed in Android Studio Logcat, what should I do? I already have the
    kotlinx-coroutines-android
    dependency...
    f
    • 2
    • 1
  • c

    Can

    03/26/2021, 11:50 AM
    Hey people! I’m trying out the new
    CompanionDeviceService
    (Android 12 DP2) while bonding with a Wifi (via SSID) and feel quite confident with my current setup. I get the following logs but my CompanionDeviceService is never called.
    2021-03-26 12:49:13.000 6062-7194/? I/CompanionDeviceManagerService: Updating associations: {Association { userId = 0, deviceMacAddress = b2:e7:e5:f7:3e:91, packageName = de.quartettmobile.companionapppoc, deviceProfile = null, notifyOnDeviceNearby = false, timeApprovedMs = Fri Mar 26 12:49:12 GMT+01:00 2021 }}  -->  {Association { userId = 0, deviceMacAddress = b2:e7:e5:f7:3e:91, packageName = de.quartettmobile.companionapppoc, deviceProfile = null, notifyOnDeviceNearby = true, timeApprovedMs = Fri Mar 26 12:49:12 GMT+01:00 2021 }}
    2021-03-26 12:49:13.006 6062-6093/? I/CompanionDeviceManagerService: Writing associations to disk: {Association { userId = 0, deviceMacAddress = b2:e7:e5:f7:3e:91, packageName = de.quartettmobile.companionapppoc, deviceProfile = null, notifyOnDeviceNearby = true, timeApprovedMs = Fri Mar 26 12:49:12 GMT+01:00 2021 }}
    :not-kotlin: 2
    • 1
    • 4
  • s

    Slackbot

    03/26/2021, 6:06 PM
    This message was deleted.
    n
    • 2
    • 1
  • k

    Kshitij Patil

    03/27/2021, 6:13 AM
    why navigation arguments of type Int, Long, Float are not nullable?
    b
    • 2
    • 4
  • f

    Freedom

    03/27/2021, 4:18 PM
    Does anyone know how to check if an environmental variables is empty in gradle ?? Ie APP_NAME I want to check if an empty string is sent back from the pipeline?
    m
    e
    • 3
    • 5
  • m

    mehul bisht

    03/27/2021, 11:18 PM
    Greetings all! Is it possible that a
    LiveData
    with a backing property (MutableLiveData) inside the ViewModel to
    Observe
    and
    Add
    to an ArrayList can cause a race condition and a
    Lock
    is required? Provided that the ArrayList will get its value from a callback.
    d
    • 2
    • 4
  • a

    andylamax

    03/28/2021, 11:19 AM
    Hello folks, where is the android gradle plugin hosted? At first I thought it was available in maven central, but no. Then I though its gotta be on the gradlePluginPortal, but naaay. Anyone knows where? Tried google, but it also failed to resolve
    j
    • 2
    • 5
  • s

    Simon Lin

    03/29/2021, 1:59 AM
    How do I call a network api when the fragment destroy? If I write api call in ViewModel with
    viewModelScope
    , it would be clear when view destroy. Using
    Globalscope
    is a good idea?
    e
    i
    t
    • 4
    • 15
  • s

    Steffen Funke

    03/29/2021, 11:36 AM
    Heyho, just trying out the new
    addRepeatingJob
    API for safely consuming Flows from ViewModel (thanks @Manuel Vivo !): https://medium.com/androiddevelopers/a-safer-way-to-collect-flows-from-android-uis-23080b1f8bda I am mostly observing multiple Flows from my ViewModel, e.g. one for the UI-State, and another one for One-Shot operations, like Toasts, Navigation, ... Would it be safe to consume them like this, with launching sub-coroutines inside
    addRepeatingJob
    ? Or would it be better to have one
    viewLifecycleOwner.addRepeatingJob(Lifecycle.State.STARTED)
    -Block for each observation?
    viewLifecycleOwner.addRepeatingJob(Lifecycle.State.STARTED) {
                launch {
                    viewModel.uiState.collect { uiState ->
                        // configure UI here
                    }
                }
    
                launch {
                    viewModel.events.collect { event ->
                        // react to one-shot events
                    }
                }
            }
    b
    • 2
    • 2
  • d

    dewildte

    03/29/2021, 11:39 PM
    Ok so I think the answer to this is yes but is it unsafe to have a
    ViewModel
    collect from a
    Flow<T>
    given to it by a
    View
    ,
    Activity
    or
    Fragment
    ? I.E.
    // MyView.kt
    val events: Flow<Event> = flowOf(Event1, Event2)
    
    viewModel.handleEvents(events)
    a
    • 2
    • 6
  • s

    Slackbot

    03/30/2021, 4:16 AM
    This message was deleted.
    e
    s
    • 3
    • 2
  • d

    Deepak Gahlot

    03/30/2021, 9:46 AM
    Hi All, I'm using StateFlow below is the code for the same. I'm facing an issue where the update in the StateFlow data is not triggering the updation of value at one place and it is working fine at the other place.
    e
    • 2
    • 7
  • m

    Muruganandham

    03/30/2021, 1:26 PM
    Hi all. Can anyone read fileuri and file path in android 11 using scoped storage
    c
    • 2
    • 1
  • k

    knthmn

    03/30/2021, 1:45 PM
    my app displays some images from the web. I need the app to have them downloaded so they can be displayed offline. I am already using Coil, how should I handle it? 1. Use Coil's backing OkHttp disk cache with no size limit and roll my own eviction policy 2. Use some other library (?) that handles this 3. Implement my own downloads (download images to a specific folder, handle all the records, eviction) 4. ???
    4️⃣ 1
    2️⃣ 1
    1️⃣ 4
    3️⃣ 1
    u
    • 2
    • 1
  • s

    Shakil Karim

    03/30/2021, 6:54 PM
    Hi All, Is there any reliable Image picking lib which support android 11 and other use cases, It is super common task and almost 99 percent of stackOverflow answers are wrong. I hope at some point there will be an Android X lib for picking Images/Video/Documents @Ian Lake Please can you suggest reliable way to achieve it across different devices and Android Versions.
    i
    s
    • 3
    • 7
  • g

    Guilherme Delgado

    03/31/2021, 10:46 AM
    Hi guys! I’m having a strange behaviour with AS:
    Android Studio Arctic Fox | 2020.3.1 Canary 12
    Build #AI-203.7148.57.2031.7226969, built on March 22, 2021
    Runtime version: 11.0.8+10-b944.6842174 x86_64
    VM: OpenJDK 64-Bit Server VM by N/A
    macOS 10.16
    GC: G1 Young Generation, G1 Old Generation
    Memory: 4096M
    Cores: 4
    Registry: ide.windowSystem.autoShowProcessPopup=true, external.system.auto.import.disabled=true, debugger.watches.in.variables=false, ide.images.show.chessboard=true
    Non-Bundled Plugins: com.intellij.marketplace, mobi.hsz.idea.gitignore, com.atlassian.bitbucket.references, com.thoughtworks.gauge, com.google.mad-scorecard, com.jetbrains.kmm, com.squareup.sqldelight
    If I have a class that has it dependencies by field injection:
    private val logger: Kermit by inject()
    I cannot attach the debugger, any break point shows this icon: 🚫 (the gray one) If it’s constructor injection it attaches ok 🤔 I’m using Koin because this is a KMM project and the code is in the commonModule. Any ideia? Thanks.
    d
    c
    • 3
    • 6
  • m

    mehul bisht

    03/31/2021, 1:37 PM
    If anyone would like to answer my question here 🙂 https://stackoverflow.com/questions/66878901/how-to-use-bottom-nav-view-and-appbarlayout-as-an-overlay-and-animate-them-in-an\
    :not-kotlin: 2
    d
    • 2
    • 3
  • a

    Andrew Ebling

    03/31/2021, 3:43 PM
    why on earth does this code throw a
    NullPointerException
    ?
    val macAddress = MacAddress.fromString(“aa:bb:cc:dd:ee:ff”)
    ...I’m passing a non-null value to an
    @NonNull
    Java method? What gives?!
    w
    m
    d
    • 4
    • 14
  • g

    gagarin55

    03/31/2021, 6:51 PM
    Hello, All! Started android development with Compose framework and looking for good books about mobile UI/UX in general, any advice much appreciated!
    d
    z
    • 3
    • 4
  • l

    Lilly

    03/31/2021, 7:49 PM
    Does this return a new map everytime it's read?
    interface Foo {
        val bar: Map<String, String>
            get() = mapOf("1" to "1")
    }
    I would say yes but not sure
    :yes: 3
    r
    r
    +2
    • 5
    • 10
  • m

    Muhammad Zaryab Rafique

    04/01/2021, 3:47 PM
    I am working on Jetpack Compose.
    c
    • 2
    • 2
  • p

    peekandpoke

    04/01/2021, 8:10 PM
    Hi! I am having trouble with the Android emulator. Not sure if this is the right place to ask this question, but maybe someone has run into the same issue before. So the problem is that Qemu produces massive disk-io ... ~400MiB/s or more and CPU is high as well. It starts when I launch an Android-Device in the emulator. Goes for some minutes and will then eventually stop. I am afraid this will destroy my SSD. Does anyone have an idea what could be the cause for this? Help is very much appreciated.
    u
    • 2
    • 1
  • j

    Justin Tullgren

    04/01/2021, 11:31 PM
    Hi, does Jetpack Compose for Android have compose "hooks"? IE I want to be notified of every (re)composition through my tree. Similar to Activity Lifecycle hooks.
    j
    a
    a
    • 4
    • 46
  • b

    Bradleycorn

    04/02/2021, 7:53 PM
    Hey all, wondering if someone (perhaps @Ian Lake?) could help me out here... I cloned the Github androidx repo, and setup my local dev environment according to the Contribution guide at https://github.com/androidx/androidx/blob/androidx-main/CONTRIBUTING.md. Everything seems great so far. I can open and build the
    navigation
    project ... But when I run tests according to the guide (I've made zero changes. Just cloned the repo, open the project build, run tests), they fail...
    cd navigation
    # Run device side and host side tests
    ./gradlew test connectedCheck
    
    .....
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':navigation:navigation-safe-args-gradle-plugin:test'.
    > There were failing tests.
    Am I doing something wrong?
    i
    • 2
    • 4
  • v

    vapoyan

    04/03/2021, 3:13 PM
    Dear Community, I need your help! I have a ViewModel where I have 2 methods both are calling
    suspend
    methods and returning a
    Double
    result. How I can organise the code so
    calculateResult()
    method is called ONLY when
    resultDoSomething1
    and
    resultDoSomething2
    are received from the server. (without booleans)
    val resultDoSomething1: Double = 0.0
    val resultDoSomething2: Double = 0.0
    
    fun doSowmthing1() {
        iewModelScope.launch {
            resultDoSomething1 = downloadDataFromServer1()
        }
    }
    
    fun doSowmthing2(){
        iewModelScope.launch {
            resultDoSomething2 = downloadDataFromServer2()
        }
    }
    
    fun calculateResult() {
         val res = resultDoSomething1 + resultDoSomething2
    }
    n
    e
    • 3
    • 3
  • a

    aniruddha dhamal

    04/04/2021, 8:58 PM
    Have question regarding Navigation Architecture component and it's deeplink. • Destination where I want to navigate belongs to other nested graph. As per this doc, Navigation using Uri doesn't reset back stack, which is what I want. But what I see Up and back behaves differently, when destination is activity vs fragment. • When destination is Fragment, up and back goes back to previous page. • When destination is Activity, up goes to the parent activity while back goes to the previous page. • My question is, is there any way to achieve same experience with Activity destination? Up and Back going back to previous page.
    :not-kotlin: 7
    t
    • 2
    • 2
Powered by Linen
Title
a

aniruddha dhamal

04/04/2021, 8:58 PM
Have question regarding Navigation Architecture component and it's deeplink. • Destination where I want to navigate belongs to other nested graph. As per this doc, Navigation using Uri doesn't reset back stack, which is what I want. But what I see Up and back behaves differently, when destination is activity vs fragment. • When destination is Fragment, up and back goes back to previous page. • When destination is Activity, up goes to the parent activity while back goes to the previous page. • My question is, is there any way to achieve same experience with Activity destination? Up and Back going back to previous page.
:not-kotlin: 7
t

therealbluepandabear

04/06/2021, 2:14 AM
Perhaps you could ask this question on 'AndroidChat' slack 🙂
a

aniruddha dhamal

04/07/2021, 6:20 AM
cc: @Ian Lake (Sorry to bother you). In case if you have any suggestion.
View count: 4