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

    Mohamed Ibrahim

    10/16/2019, 10:41 AM
    int for example the
    ApiManager.INSTANCE.doSomething()
    , can we override the INSTANCE getter function?
    g
    s
    k
    • 4
    • 8
  • l

    Leon K

    10/16/2019, 3:52 PM
    hey, I've got a problem: I'm trying to use Retrofit with the Kotlin Coroutine-integration (just make the functions in the
    API
    interface
    suspend
    and return the data directly, without being wrapped in
    Call
    ) but as soon as i try to do this, i get
    java.lang.IllegalArgumentException: Could not locate call adapter for class java.lang.Object.
    any ideas? if i use the
    Call
    wrapped way it works
    d
    g
    u
    • 4
    • 11
  • s

    Sergio C.

    10/16/2019, 4:52 PM
    do we have the bundle saved instance state after the app recovers from a crash? didn't find relevant results online. thanks for the icons
    :google: 1
    :stackoverflow: 2
    r
    • 2
    • 2
  • s

    SrSouza

    10/16/2019, 5:46 PM
    HI guys, someone can tell me if Retrofit ignore a
    @Body
    null?
    @PUT("create/{name}")
    fun create(@Path("name") name: String, @Adrien Body requestBody: NameRequestBody?)
    r
    j
    • 3
    • 3
  • s

    Schadenfreude

    10/17/2019, 12:44 PM
    Hey, everyone, I’ve been trying to find a way to reverse the order of the items in a paged list (or its data source) but I’m having 0 luck and can’t find any articles on how to do that. Does anyone know a way to achieve this?
    a
    s
    • 3
    • 7
  • k

    Kevin Janvier Chinabalire

    10/17/2019, 3:11 PM
    Anyone using kodein dependency injection here ???
    s
    a
    j
    • 4
    • 8
  • s

    Slackbot

    10/17/2019, 5:12 PM
    This message was deleted.
    🤯 1
    :stackoverflow: 2
    k
    • 2
    • 1
  • a

    Andy Gibel

    10/18/2019, 1:49 PM
    Has anyone given formal workshops at work to train their team on Kotlin? Do most people just follow the Koans or does anyone know of some opensource lesson materials to use?
    d
    m
    +3
    • 6
    • 12
  • d

    Davide Giuseppe Farella

    10/19/2019, 5:02 AM
    Hello, I’ve updated some stuff ( Gradle, AGP, plugins & libs ) and now I have this error
    Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option
    calling inline functions from libs (
    ktx
    & various
    -ktx
    ). What could have go wrong? I have both:
    android
        compileOptions {
            sourceCompatibility = JavaVersion.VERSION_1_8
            targetCompatibility = JavaVersion.VERSION_1_8
        }
    }
    &&
    tasks.withType<KotlinCompile> {
        kotlinOptions.jvmTarget = "1.8"
    }
    ✔️ 1
    g
    • 2
    • 3
  • d

    Davide Giuseppe Farella

    10/19/2019, 5:06 AM
    m
    • 2
    • 1
  • a

    Alexander

    10/20/2019, 10:41 AM
    I'm new to Android programming and I have been trying to decide on the best approach for polling a device for long/lat. Originally, I was going to have this in a background service, but having read that you can only really poll once in a 15 minute time-frame I have since abandoned that. I have read that AlarmManager can be used however, I feel like this to, isn't suitable. I have been looking into Foreground Services and they seem OK - however; Whats my best approach if I want to run a task in a foreground service say every 10 seconds? - is a foreground service even the right way to go?
    k
    v
    • 3
    • 39
  • m

    Mohamed Ibrahim

    10/21/2019, 8:01 AM
    Does any one know what the use of
    androidx.concurrent
    component, is there any sources talking about it
    g
    a
    • 3
    • 4
  • i

    ivano

    10/21/2019, 11:13 AM
    why onEvent is not triggered?
    :stackoverflow: 2
    c
    • 2
    • 9
  • j

    Jazz

    10/21/2019, 12:20 PM
    Hello My project is MVVM architecture. I use dataBinding with ViewModel and View and ViewModel is AAC ViewModel. I know ViewModel must never reference a view, or it occur memory leak. When onClick called, I pass view by parameter. Although ViewModel doesn’t hold view, is it occured memory leak? android:onClick=“@{(v) -> viewmodel.onClick(v)}”
    w
    • 2
    • 3
  • p

    Paul Dhaliwal

    10/21/2019, 2:25 PM
    In my app I always retrieve data from a room database, display it, and then update the data over the network (and then animate the change in data). I’m wondering what the best approach would be using clean architecture. Currently in the ViewModel a coroutine is launched and from inside the coroutine a Use Case is executed to retrieve the data from the db, then the livedata object (observed by the view) is updated. After this a second Use Case is launched to retrieve the data from the network, and then the livedata is updated again. I would like to be able to simplify this so that the ViewModel doesn’t know about where the data is coming from (or the fact that it comes from db first then network), so that it simply executes one GetDataUseCase and inside the use case (or inside the repository if that is preferable) I will retrieve data from db first, push data back to the ViewModel, then retrieve data from network, and push the updated data to the ViewModel. What would be the best approach to achieve this? I thought about adding LiveData objects inside the UseCase or Repository however in order to observe these objects I need to give them a lifecycle owner, and also since the whole process is kicked off inside a coroutine inside the ViewModel, I’m not sure how to do that. I’ve also read that the UseCase should be a pure Java/Kotlin file so that it stays testable.
    :stackoverflow: 1
    r
    • 2
    • 5
  • a

    Andy Gibel

    10/21/2019, 8:38 PM
    Can anyone share their goto approach for Intent dispatching using Kotlin? I've seen Context Extensions for instance
    Context.startParticularScreen(intentParams)
    but that seems wrong given it's an extension on such a global object
    p
    • 2
    • 2
  • k

    katz

    10/22/2019, 12:51 PM
    Hi all, did some one face similar - AS3.5 -> AS3.5.1 update broke synthetics. tryed: Invalidate & restrt, reimport, clearing cache, full rebuilds, downgradte to AS3.5 and it keep broken 0_0
    t
    r
    • 3
    • 3
  • s

    stkent

    10/22/2019, 2:14 PM
    Has anyone dealt with "synchronizing" coroutines across Android lifecycle events? For example:
    onCreate(...) {
        scope.launch {
            asyncThing()
        }
    }
    
    onResume(...) {
        scope.launch {
            // code that depends on asyncThing() having completed
        }
    }
    Is there a way to "join" such that the onResume work does not start until the
    asyncThing
    is done?
    k
    • 2
    • 3
  • m

    mingkangpan

    10/23/2019, 9:14 AM
    Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option
    anyone dealt with this error before? I have specified target to 1.8 in gradle and also in kotlin compiler target...
    :stackoverflow: 1
    m
    • 2
    • 1
  • z

    zceejkr

    10/23/2019, 12:46 PM
    Hi, one question: What is the difference between declaring a function as a val vs declaring it as a fun on a class? I read somewhere that when calling from Java, the one defined with val becomes cumbersome to use. Is that still the case?
    g
    a
    • 3
    • 18
  • m

    Mohamed Ibrahim

    10/24/2019, 7:40 AM
    does anyone know how to debug a FCM notification while app is closed
    m
    g
    • 3
    • 11
  • s

    StepanV

    10/24/2019, 10:26 AM
    Anyone got the Kotlin Android associate certificate discount code from Android Dev Summit Livestream?
    😀 1
    👀 1
    a
    • 2
    • 2
  • m

    mending3

    10/24/2019, 11:02 AM
    could someone explain what use case we face when we will to use ViewModelFactory and pass the ViewModelFactory to the second argument of
    ViewModelProviders.of()
    ?
    p
    • 2
    • 2
  • v

    vitrox1

    10/24/2019, 1:02 PM
    hello guys i know this is not the right place to ask but how many of you uses spoon-client/2.0.0-SNAPSHOT??? it seems disapeared from the internet 😞
    d
    • 2
    • 3
  • l

    Lucas Borges

    10/24/2019, 1:38 PM
    It's ok inject a ViewModel in a BottomSheet? My BottomSheet should load some options to show
    w
    • 2
    • 2
  • a

    Artem

    10/24/2019, 4:25 PM
    Hello guys, simple question: where can I find Android Jetpack libraries source code?
    f
    r
    • 3
    • 4
  • t

    Travis Griggs

    10/24/2019, 10:16 PM
    Does AndroidStudio for Kotlin have anything like the
    // MARK:
    syntax that shows up in XCode/Swift. It’s really handy for organizing chunks of functionality in different files
    r
    w
    d
    • 4
    • 9
  • m

    mending3

    10/25/2019, 7:17 AM
    I've got error:
    navigation destination com.example.app.myapp/action_homeFragment_to_mainFragment is unknown to this NavController
    mainFragmentViewModel.navigateToHome.observe(this, Observer {
                if (it) {
                    this.findNavController().navigate(R.id.action_mainFragment_to_homeFragment)
                } else {
                    this.findNavController().navigate(R.id.action_homeFragment_to_mainFragment)
                }
            })
    s
    • 2
    • 2
  • f

    Freedom

    10/25/2019, 11:33 AM
    Any one can help me or link me to a resource on a proper way to handle login with mvvm pattern and using sealed classes and using room as a cache storage I iv always have problem with this
    r
    • 2
    • 1
  • j

    J6ey

    10/25/2019, 8:20 PM
    Hi guys i'm still hesitant on switching from java to kotlin. Kotlin is still a beta language and the number of users still seems relatively low compared to java and since it first released. Do you guys really think kotlin is worth learning and will survive in the future?
    😕 3
    :trollface: 6
    😂 10
    :goberserk: 1
    🤣 3
    :kotlin: 5
    c
    k
    +5
    • 8
    • 13
Powered by Linen
Title
j

J6ey

10/25/2019, 8:20 PM
Hi guys i'm still hesitant on switching from java to kotlin. Kotlin is still a beta language and the number of users still seems relatively low compared to java and since it first released. Do you guys really think kotlin is worth learning and will survive in the future?
😕 3
:trollface: 6
😂 10
:goberserk: 1
🤣 3
:kotlin: 5
c

cedric

10/25/2019, 8:21 PM
Google would certainly disagree with you that Kotlin is a beta language 🙂
👍 16
k

Kris Wong

10/25/2019, 8:26 PM
not to mention certain Android components will be Kotlin only
h

hetang

10/25/2019, 8:38 PM
my apps are fully Kotlin. this is current GitHub language states looks for Kotlin:
so I do not think its beta language any more
j

J6ey

10/25/2019, 9:09 PM
Thank you guys for the clarification!
a

Adam Powell

10/25/2019, 9:22 PM
https://android-developers.googleblog.com/2019/10/android-dev-summit-2019-keynote.html
almost 60% of our top 1000 apps are using Kotlin
👍 1
c

Casey Brooks

10/25/2019, 9:37 PM
There are components and libraries of the core Kotlin ecosystem that are still in beta, but the language itself and its standard library is definitely production-ready. In particular, things around multiplatform and some coroutines features are still in beta. But you’ve got nothing to worry about if you’re just looking to replace Java and keep using the Java libraries you’re used to, that portion of Kotlin is very stable and growing very quickly
Here are a few more thoughts I have on this topic: https://dev.to/cjbrooks12/comment/7g2o
👍 1
🤔 1
c

cedric

10/25/2019, 9:50 PM
That thread has some gems:
Scala, which is a functional language inspired by Lisp.
or the claim that Clojure has better interop with Java than Kotlin because you never need to cast (author forgetting that Clojure is dynamically typed I assume)
l

louiscad

10/26/2019, 10:25 AM
Quantity < Quality
t

tseisel

10/27/2019, 10:41 AM
In fact, Kotlin is one of the languages that registered the fastest growth this year. Of course it doesn't have more users than Java (but no programming language has !) I can't see the future, but Kotlin is likely to survive (as it has been endorsed by Google for Android Development), and IMHO it could even remplace Java in the next 10 years (because it compiles to the JVM, but also to JS and Native). At worst it'll be a Android-only language and at best it will kill Java and take over the programming world. We'll see.
l

louiscad

10/27/2019, 10:58 AM
Kotlin can't die anyway, it's open source, and has a big and fast growing community. Its current feature-set is already vastly superior to many other programming languages, and upcoming things like HMPP (hierarchical multiplatform) will only make it more desirable for many projects.
View count: 2