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

    Allan Wang

    02/08/2020, 7:15 PM
    It seems like even now, adding kotlin-android-extensions for parcelize only:
    androidExtensions {
        experimental = true
        features = ["parcelize"]
    }
    results in synthetic id suggestions in the IDE. Is there a way to address this and disable synthetics completely?
    m
    i
    a
    • 4
    • 14
  • g

    Gabriel Feo

    02/08/2020, 8:08 PM
    Exposing a
    suspend fun
    from a nested Fragment to be called by the parent Fragment. What’d happen if the nested Fragment gets killed before the suspension point returns?
    o
    s
    • 3
    • 7
  • k

    kyleg

    02/09/2020, 1:51 AM
    I have a fragment and a recyclerview adapter with a couple holders and all need to know whether my app is currently in RO or RW mode to render the UI correctly (inputs vs just text, buttons GONE vs VISIBLE, etc.) RIght now I’m passing a LiveData from the viewmodel to the fragment to the adapter to the holders. THis is a lot of tight coupling. Is there a better way? This is pretty much the only bit of data that seems like it’s more “global” than anything else, which I’ve got pretty compartmentalized into whatever object actually needs that data.
    g
    • 2
    • 1
  • k

    Kevin Hester

    02/09/2020, 2:30 PM
    Hi ya'll I've been using kotlin on android for a while but I'm only now trying Jetpack Compose. I've read through the tutorials but I don't understand one thing: how do I convert changes from outside of the Compose hierarchy into Model visible changes that cause the GUI to reactively redraw? My use case is "I have a BroadcastReceiver that is setting a bool called isConnected to true". Since this bool is not changing due to a button press (or some other event GUI widget), it is starting outside of "compose land 😉 ". I tried wrapping the bool with +state but that throws an error on the line of declaration "java.lang.IllegalStateException: Composition requires an active composition context" Any advice appreciated!
    m
    a
    • 3
    • 7
  • d

    dave08

    02/09/2020, 3:04 PM
    Should I pay attention to Android Studio's warning for
    build.gradle.kts
    :
    This project uses Gradle KTS build files which are not fully supported. Some functions may be affected.
    ?
    i
    c
    l
    • 4
    • 14
  • m

    Michael Limb

    02/11/2020, 6:13 PM
    Is there a way to simplify this code?
    override fun initializeViewModel(): OnboardingViewModel {
            val model: OnboardingViewModel by viewModels { viewModelFactory }
            return model
        }
    w
    a
    • 3
    • 5
  • n

    Nav Singh

    02/11/2020, 10:10 PM
    it doesn't work any idea what's wrong here
    b
    t
    m
    • 4
    • 6
  • t

    Tim Malseed

    02/11/2020, 11:51 PM
    I’m having some trouble refactoring an Android codebase to make use of Square’s
    @AssistedInject
    with Dagger 2, though I’ve used it with success in other projects.. It seems as though the `@AssistedInject.Factory Factory`is not being provided its non-assisted properties. I don’t quite have the terminology to describe this problem, so I’ll show rather than tell:
    b
    a
    • 3
    • 20
  • p

    pablisco

    02/12/2020, 11:10 AM
    I came across an odd thing (and didn’t find anything on :google: ) I have a delegate property. Inside this property I call a method that requires API 23. I’ve marked the property with:
    @get:RequiresApi(23)
    however, I’m still getting a lint about the use of a new API level. I’ll add more details as a thread…
    g
    r
    • 3
    • 12
  • j

    Joan Colmenero

    02/12/2020, 12:42 PM
    Do you guys use any generic BottomSheetDialogFragment? Or you guys create different ones extending that one? I mean do you guys use any customBottomSheetDialogFragment which is reusable depending of the parameters?
    s
    • 2
    • 2
  • l

    Leeway

    02/12/2020, 11:04 PM
    Hi all, after enable the
    minifyEnabled
    , I encountered some error as:
    E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1
        Process: <http://com.org|com.org>.appname, PID: 17870
        java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter $this$collectionSizeOrDefault
            at kotlin.collections.CollectionsKt__IterablesKt.collectionSizeOrDefault(Unknown Source:2)
            at kotlin.collections.CollectionsKt.collectionSizeOrDefault(Unknown Source:0)
            at <http://com.org|com.org>.appname.c.a.c.a(:93)
            at <http://com.org|com.org>.appname.c.a.c$b.invokeSuspend(:41)
            at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(:33)
            at kotlinx.coroutines.p0.run(:241)
            at kotlinx.coroutines.g2.a.a(:594)
            at kotlinx.coroutines.g2.a.a(:60)
            at kotlinx.coroutines.g2.a$b.run(:740)
    Seems like something to do with proguard rules. I tried
    -keep class kotlinx.** { *; }
    -keep class kotlin.** { *; }
    But it didn't work. Any ideas?
    i
    • 2
    • 7
  • y

    Yugandhar

    02/13/2020, 6:48 AM
    What is the difference between arrayof and IntArrayof and intArrayOf in kotlin
    a
    z
    • 3
    • 2
  • r

    Remy Benza

    02/13/2020, 7:21 AM
    Why isn't there a coroutine Flow livedata builder which returns mutableLivedata?
    v
    f
    z
    • 4
    • 11
  • k

    Kirill Prybylsky

    02/13/2020, 9:17 AM
    While using MVVM I have a lot of live data objects inside ViewModel (especially for actions), so I made this: https://pastebin.com/DhXKEpAA What cons can it have? Combined with coroutines it can be like this: https://pastebin.com/6phjEQZC
    a
    r
    m
    • 4
    • 12
  • m

    M Sinan Sari

    02/13/2020, 12:51 PM
    Hello, I hope you are all doing well. I have a little question; I am using navigation component, single activity multiple fragment. I have a tiny problem with deeplink. • I’ve set
    <nav-graph/>
    in manifest and also set
    launcherMode="singleTask"
    , • I’ve set
    <deeplink/>
    in navigation graph. • I’ve handled intent extras in fragment. My flow is; • User clicks to forgot password, fills edit texts then requests deeplink mail. Works fine • User clicks to deeplink in email and selects app then navigates to
    CreatePasswordFragment
    automatically (deeplink destination fragment) & (I can handle args here, works fine also) The problem is;
    Sometimes
    if app is open on background, (for example I requested mail then pressed home button) and when I click deeplink, last fragment runs instead of destination fragment which is
    CreatePasswordFragment
    Any ideas about what may cause the problem? Thanks! The problem is that, if app is open in background, sometimes
    m
    • 2
    • 8
  • d

    dave08

    02/13/2020, 1:41 PM
    Am I right that using
    runBlocking { }
    in a `SyncAdapter`'s
    onPerformSync
    or in a
    Service
    will crash the application with an
    InterruptedException
    (as in https://github.com/Kotlin/kotlinx.coroutines/blob/9be85a44f157cea6bf14b685a87c6709ebd9664b/kotlinx-coroutines-core/jvm/src/Builders.kt#L27 )? What does everyone do about this? Surround it with a
    runCatching { runBlocking { } }
    🙈?
    s
    l
    • 3
    • 8
  • t

    Tim

    02/13/2020, 3:11 PM
    i get this seems like a very easy question to google but i am not really seeing anything on this. is there any reason that calling setVisibility(View.GONE) on a view would just not work? even in the Preview for android studio it doesnt disappear when using android:visibility=“gone” or tools:visibility=“gone”
    a
    • 2
    • 2
  • s

    Steve

    02/13/2020, 5:58 PM
    I have a kiosk mode app, and I'm trying to get it to launch at boot on API 27/28. I have a BroadcastReceiver declared in the manifest for boot completed, and it is launching my initial splash activity. However, when the splash activity goes to launch the main activity, it seems to go back to the launcher.
    a
    s
    a
    • 4
    • 11
  • a

    Arslan Mushtaq

    02/13/2020, 10:26 PM
    Hi everyone, I’m stuck on a simple problem of #android Connectivity. I want to check for internet connection using a Broadcast Receiver which supports both the Android 10 and lower versions as I have set my app minimum SDK to 19. The issue I’m facing is the NetworkInfo class which is deprecated according to Documentation.
    s
    • 2
    • 1
  • l

    lawlorslaw

    02/14/2020, 7:21 AM
    and the object is of type Cell, where Cell is a class
    :stackoverflow: 1
    • 1
    • 1
  • l

    lawlorslaw

    02/14/2020, 8:28 AM
    does the outer loop need to iterate over j and the inner loop iterates over i ?
    :thread-please: 1
    t
    • 2
    • 3
  • k

    karandeep singh

    02/14/2020, 11:53 AM
    is there anyway to mimic android app update flow offline (command line/bundle tool)? (using aab)
    l
    • 2
    • 1
  • s

    stantronic

    02/14/2020, 12:17 PM
    Noticing a few crashes in our app caused by NPEs - the pattern seems to be when an alert dialog calls a success lambda which then calls a method in a fragment which performs some action on a kotlin synthetic property view. Has anybody faced anything similar? I’m struggling to work out whether its because of lifecycle issues, or the way lambdas work, or the way synthetic properties work, or all of the above.
    g
    b
    +2
    • 5
    • 14
  • a

    Antoine Gagnon

    02/14/2020, 5:27 PM
    Do you know if there’s any way to prevent the use of part of the native SDK in Android Studio ? For instance, I don’t want developers to be able to use SharedPreferences and want to force them to use another class I made called LocalStorage (or at least give them the deprecated warning)
    b
    k
    • 3
    • 13
  • s

    Steve

    02/14/2020, 5:51 PM
    Using Espresso, is there a way to determine if the app under test has a certain permission granted? I've tried calling checkPermission on the target context, but the tests seem to run as a different user than the app, so it always indicates the permission is denied.
    s
    i
    z
    • 4
    • 12
  • o

    Ofir Bar

    02/14/2020, 11:43 PM
    I came across this code inside
    AccessibilityEvent
    I wonder why the android team choose to represent ints in hexadecimal for static fields. Of course we can’t know why unless we ask the team directly i guess. So, in general, why the use of hexadecimal might be beneficial to represent ints in such case?
    a
    t
    • 3
    • 2
  • t

    Travis Griggs

    02/15/2020, 1:47 AM
    I am trying to include HiveMQ’s android client library for MQTT. However, when I follow their code samples:
    this.client = Mqtt3Client.builder()
          .identifier(clientId)
          .serverHost("<http://abc.xyz.com|abc.xyz.com>")
          .sslWithDefaultConfig()
          .buildAsync()
    The
    builder()
    message is being underlined in red and the popup error message says:
    Calls to static methods in Java interfaces are prohibited in JVM target 1.6 Recompile with '-jvm-target 1.8'
    Is there a way to fix this. Or rather, how do I do what it’s telling me to do? Somewhat of a neophyte with kotlin/Android here, be kind please.
    i
    g
    • 3
    • 2
  • f

    Freedom

    02/15/2020, 11:19 PM
    h
    m
    k
    • 4
    • 8
  • l

    lawlorslaw

    02/16/2020, 1:53 AM
    does anyone have any luck setting up the
    @Parcelize
    annotation on a class https://android.jlelse.eu/yet-another-awesome-kotlin-feature-parcelize-5439718ba220 i tried this but it doesnt recognize the import .
    import kotlinx.android.parcel.Parcelize
    and i did a gradle sync after adding
    android{
      androidExtensions {
        experimental = true
      }
    }
    a
    • 2
    • 23
  • j

    Joan Colmenero

    02/16/2020, 8:06 PM
    Anyone of you have used Firebase Auth with SMS? I'm planing to use it, and I want to hear opinions. I'm planning to build an app that the login is the SMS verification. Is Firebase Auth the best way to do it? I saw that there's more apis that does that.
    :google: 1
    :stackoverflow: 1
    d
    d
    j
    • 4
    • 6
Powered by Linen
Title
j

Joan Colmenero

02/16/2020, 8:06 PM
Anyone of you have used Firebase Auth with SMS? I'm planing to use it, and I want to hear opinions. I'm planning to build an app that the login is the SMS verification. Is Firebase Auth the best way to do it? I saw that there's more apis that does that.
:google: 1
:stackoverflow: 1
d

dave

02/16/2020, 11:15 PM
Have used it before. It’s perfectly fine. You need to check for pricing. Yes probably many options for the same, yet pricing and stability should be taken into account. Also development effort.
d

dawidhyzy

02/17/2020, 4:54 AM
Please, read the channel topic.
j

Jeff

02/17/2020, 5:14 AM
One downside of Firebase Auth is that you cannot customize the message sent to the user. Otherwise it's easy to implement.
j

Joan Colmenero

02/17/2020, 12:40 PM
@Jeff then to create your own message you have to implement your own API?
j

Jeff

02/17/2020, 12:42 PM
Yeah, if you want a custom message you can implement your own API or try other third parties like Twilio.
j

Joan Colmenero

02/19/2020, 10:07 PM
I saw Twilio, but I do not have like firebase 10k sms free per month, right? Do you know if I have to pay something to use Twilio and SMS?
View count: 2