https://kotlinlang.org logo
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
  • p

    pollux-

    10/09/2020, 11:29 PM
    Is this Anti pattern : having two ViewModel in Fragment or Activity . I don't think so, I have a certain common things let's permission handling in One PermissionVm which I'll be using in multiple activities . I think this is Ok. What you guys think about that??
    :stackoverflow: 1
    :google: 1
    a
    b
    o
    • 4
    • 9
  • o

    okarm

    10/10/2020, 2:19 PM
    This channel needs a janitor to remove the influx of irrelevant questions. Some people apparently can’t read and treat this Kotlin-specific Slack space as SO.
    ☝️ 4
    ➕ 7
    💯 1
    m
    • 2
    • 1
  • o

    outadoc

    10/13/2020, 8:34 AM
    Hi all. I’m still unclear on what the version of Kotlin bundled with Android Studio actually means. AS 4.1 comes bundled with Kotlin 1.3.72; does that mean that if my project references Kotlin 1.4, what the editor’s linting shows me might NOT be what the Kotlin compiler actually errors on? i.e. if I try to use a
    continue
    in a for/when loop, the editor will show an error but the project compiles fine? Either way both Google and Jetbrain’s docs are not clear on the subject 😞
    :google: 8
    a
    t
    • 3
    • 4
  • s

    Slackbot

    10/13/2020, 8:51 PM
    This message was deleted.
    a
    s
    • 3
    • 2
  • l

    Liyue

    10/14/2020, 4:03 AM
    Hi, I am a new kotlin developer For some reasons, I need to pay attention to the association between Android Kotlin and official Kotlin. Is the official Kotlin compiler used for Android project compilation?
    z
    g
    f
    • 4
    • 5
  • p

    Pau

    10/14/2020, 7:20 AM
    Morning from Europe, anyone in here has done the Android Associate Certificate? Is it good enough for someone trying to enter in the industry?
    c
    • 2
    • 3
  • a

    Ayden

    10/14/2020, 9:59 AM
    Hi guys. May I know how to miss a
    Dialog
    after the onClick action? The
    onClick
    action is bound with the
    QuoteViewModel
    . I would assume the
    ViewModel
    should not in charge of closing the
    Dialog
    , since the responsiblity of the ViewModel is to process and manipulate the data.
    <com.google.android.material.button.MaterialButton
                    android:id="@+id/btn_submit_quote"
                    ...
                    android:onClick="@{(view) -> quoteViewModel.save()}"
                    android:text="@string/submit"
                    ... />
    :stackoverflow: 3
    :google: 2
    n
    • 2
    • 1
  • l

    Leandro Ocampo

    10/14/2020, 4:15 PM
    hello people! I tried to find a solution through google without success. I am working with the kotlin IR compiler plugin and it is working wonderfully. I have this in my app:build.gradle:
    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
        compileTask -> compileTask.dependsOn ":custom-create-plugin:createNewPlugin"
    }
    What I need is to make this compileTask to depend on this task only for release builds. Any ideas? I already tried something like this without success:
    if (getGradle().getStartParameter().getTaskRequests().toString().contains("release")){
        tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
            compileTask -> compileTask.dependsOn ":custom-create-plugin:createNewPlugin"
        }
    }
    o
    • 2
    • 2
  • a

    Afzal Najam

    10/14/2020, 5:18 PM
    Do we need to call
    viewModelScope.cancel()
    In ViewModels? I see that the documentation for ViewModel.kt says:
    * This scope will be canceled when ViewModel will be cleared, i.e [ViewModel.onCleared] is called
    But I can't find the code that actually calls
    close()
    f
    • 2
    • 2
  • r

    Robby

    10/14/2020, 6:16 PM
    Hello How to Show Different different type of Map in google map? Does anyone have an Idea?
    :google: 2
    :stackoverflow: 4
    c
    • 2
    • 2
  • m

    Matthew Laser

    10/14/2020, 6:26 PM
    anyone have any idea on how Jetpack Compose development is going or what a Beta / RC timeline will be like?
    z
    • 2
    • 3
  • o

    Orhan Tozan

    10/15/2020, 1:05 PM
    viewModel.notes.observeInLifecycleScope { notes ->
                viewBinding.informationTextInput.text = notes
                // Fix for mysterious bug when the family notes textview doesnt update when navigated from home screen.
                lifecycleScope.launch {
                    viewBinding.informationTextInput.isVisible = false
                    viewBinding.informationTextInput.isVisible = true
                    repeat(10) {
                        delay(100)
                        viewBinding.informationTextInput.isVisible = false
                        viewBinding.informationTextInput.isVisible = true
                    }
                }
            }
    There is this mysterious bug where screen A works fine when navigated from screen B(screen B -> screen A) . But when navigated from screen C -> screen A, there is this small chance the textview showing weird, empty content. The code under the comment hilariously fixes that issue... but still have no clue why 😂
    l
    i
    • 3
    • 20
  • t

    tarek

    10/15/2020, 1:46 PM
    Hi I’m having issues when trying to migrate to AGP 4.1.0 and using KTS Gradle build files With AGP 4.0.1, everything works fine With AGP 4.1.0 I have
    NoSuchMethodError: 'void com.android.build.gradle.internal.dsl.DefaultConfig.setApplicationId(java.lang.String)'
    Any ideas?
    v
    • 2
    • 1
  • f

    Florian

    10/15/2020, 4:15 PM
    As a Kotlin user, should I prefer the Firebase API's await methods over callbacks? Are there any caveats? The coroutine scope will not actually cancel async Firebase methods will it?
    i
    o
    • 3
    • 5
  • f

    Florian

    10/15/2020, 8:44 PM
    I have a question about conditional navigation. I want to navigate to a login screen when the user is not signed in, but as opposed to the tutorial in the documentation I want to do that from any screen. I couldn't get the SavedStateHandle approach working for my use case. I'll describe my approach in the thread and maybe someone wants to take a look at it and tell me if I'm missing something since it's quite different from the description in the documentation.
    👍 1
    i
    • 2
    • 37
  • k

    KV

    10/16/2020, 5:09 AM
    Hi, I have a question related to API call with different filters in OKHTTP network calls. How do I set up a 1 api call with different parameters without using retrofit? NOTE: I am using okhttp for calling the apis. I am not using 
    retrofit
    Example : 1. https://baseurl/search/q[name_eq]=Example 2. https://baseurl/search/q[name_not_eq]=Example 3. https://baseurl/search/q[name_not_eq]=Example 4. https://baseurl/search/q[name_matches_all]=Example 5. ---- 6. ---- 7. ---- I don't want to write different api calls with different search criteria. Do we have any simpler way to handle this kind of url for calling the same API with different parameters?
    g
    • 2
    • 1
  • s

    Slackbot

    10/16/2020, 7:10 AM
    This message was deleted.
    g
    g
    t
    • 4
    • 5
  • c

    coroutinedispatcher

    10/16/2020, 9:31 AM
    Probably it's me doing something wrong but doesn't hurt to ask. Has anybody else felt lag navigating with NavComponent?
    ✋🏼 2
    m
    c
    • 3
    • 4
  • s

    Slackbot

    10/16/2020, 9:47 AM
    This message was deleted.
    c
    • 2
    • 1
  • s

    Slackbot

    10/16/2020, 4:18 PM
    This message was deleted.
    d
    • 2
    • 1
  • s

    Slackbot

    10/17/2020, 12:54 PM
    This message was deleted.
    a
    r
    • 3
    • 2
  • z

    ziv kesten

    10/17/2020, 1:40 PM
    Is there a way to pass events from websocket to view model without RxJava and callback? RxJava is just to big to implement in my project just for this need. Flow is still not ready for production (is it?) And liveData does not seem like a good fit (no need for lifecycle awareness in this case)
    l
    i
    +2
    • 5
    • 8
  • a

    Ayden

    10/18/2020, 3:52 AM
    Hi guys. I have the
    onClickListener
    ,
    itemClicklLisntener
    in my
    MainActivity.kt
    which will response to user onClick activity.
    Question
    But why the view model does not display the value on the fragment?
    
    MainActivity - <https://pastebin.com/4Zp492kn>
    
    QuoteAdapter - <https://pastebin.com/WGSVdh6H>
    
    QuoteViewModel - <https://pastebin.com/X6mv0pH7>
    
    QuoteFragmentLayout -<https://pastebin.com/U4Qcm902>
    i
    • 2
    • 6
  • m

    Marek Kubiczek

    10/18/2020, 11:58 AM
    Does anyone know if it is possible to show Android's
    PopupWindow
    above
    DialogFragment
    ? I would like to show
    BottomSheetDialogFragment
    with a context menu and at the same time be able to show a clickable
    PopupWindow
    above the bottom sheet. Whatever I tried the popup was always shown behind the BottomSheet's outsideTouchArea making the popup unable to intercept touches. When looking at layout inspector the
    PopupDecorView
    was always placed below Dialog's
    DecorView
    .
    t
    • 2
    • 2
  • s

    Sergio C.

    10/18/2020, 7:09 PM
    como é que é man?
    l
    j
    • 3
    • 5
  • m

    Michael

    10/18/2020, 8:08 PM
    Where is menuInflater defined?
    a
    • 2
    • 1
  • x

    xxfast

    10/19/2020, 12:21 AM
    Hi all - is there a way to only enable new explicit api mode for main src set? currently it seems to be applied for all the src sets - even tests
    b
    c
    p
    • 4
    • 4
  • k

    kevin.cianfarini

    10/19/2020, 2:57 AM
    Is it possible to get a DEX method count breakdown by dependency? I have this grouping of dependencies and it's got more than 65K methods while writing very little code of my own.
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    
        implementation 'androidx.core:core-ktx:1.3.2'
        implementation "androidx.fragment:fragment-ktx:1.2.5"
        implementation 'androidx.appcompat:appcompat:1.2.0'
        implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
    
        implementation "com.squareup.retrofit2:retrofit:2.9.0"
        implementation "com.squareup.retrofit2:converter-moshi:2.9.0"
        implementation "com.squareup.moshi:moshi-kotlin-codegen:1.11.0"
        kapt "com.squareup.moshi:moshi-kotlin-codegen:1.11.0"
    
        implementation 'com.google.dagger:hilt-android:2.29.1-alpha'
        kapt 'com.google.dagger:hilt-android-compiler:2.29.1-alpha'
        implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha02'
        kapt 'androidx.hilt:hilt-compiler:1.0.0-alpha02'
    Cannot fit requested classes in a single dex file (# methods: 70231 > 65536)
    i
    l
    • 3
    • 10
  • s

    Sam

    10/19/2020, 9:05 AM
    Hello you guys, I have upgrade Android Studio to 4.1 and clear all cache, but I can see normal package/module in my project? So anyone have a solution for that ?
    g
    • 2
    • 5
  • l

    Leandro Ocampo

    10/19/2020, 10:49 AM
    Hey guys... is it safe to use
    val someView by lazy { findViewById(R.id.some_view) }
    ? My concern is can happen that an Activity / Fragment may need to recreate (inflate again) the view but being the same object? Let's say onCreate (activity) or onCreateView (fragment) is called again for the same object I think it is safe to do this in an activity, but I do not think so for Fragments 🤔
    g
    • 2
    • 1
Powered by Linen
Title
l

Leandro Ocampo

10/19/2020, 10:49 AM
Hey guys... is it safe to use
val someView by lazy { findViewById(R.id.some_view) }
? My concern is can happen that an Activity / Fragment may need to recreate (inflate again) the view but being the same object? Let's say onCreate (activity) or onCreateView (fragment) is called again for the same object I think it is safe to do this in an activity, but I do not think so for Fragments 🤔
g

gildor

10/19/2020, 11:19 AM
Yes, it's unsafe for current implementation of fragments
View count: 27