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

    Tushar

    06/19/2018, 9:47 AM
    How to get location update continuously in background in android oreo?
    :stackoverflow: 7
    e
    j
    • 3
    • 2
  • t

    Tim Castelijns

    06/19/2018, 9:51 AM
    short answer: you can’t
    u
    t
    • 3
    • 6
  • p

    purna

    06/19/2018, 11:10 AM
    I was wondering which would be better declaration of a method
    suspend fun methodName(image: Bitmap?): String? = async {
       // heavy task
    }.await()
    OR
    fun methodName(image: Bitmap?): String? {
       //heavyTask
    }
    and in Code
    async{
       methodName()
    }.await()
    ❎ 1
    2️⃣ 1
    1️⃣ 3
    g
    • 2
    • 1
  • a

    aperfilyev

    06/19/2018, 2:10 PM
    I’ve made a thread on SO https://stackoverflow.com/questions/50930472/noclassdeffounderror-after-upgrading-kotlin-from-1-2-31-to-1-2-41-1-2-50
    r
    • 2
    • 7
  • j

    jtravis

    06/19/2018, 6:29 PM
    Is there a good sample application out there which shows best-of-breed usage of kotlin, architecture components, (butterknife? dagger?) etc.?
    d
    b
    • 3
    • 3
  • a

    Ayden

    06/20/2018, 9:34 AM
    I see. Thank you for the explaination @gildor
    g
    • 2
    • 3
  • k

    Ketan

    06/20/2018, 4:13 PM
    Hi Guys, I am new to Kotlin. I have a question. What would be memory impact if I use object AndroidDTO { data class Request(name: String) data class Response(api: String) } Instead of two different data classes as below: data class Request(name: String) data class Response(api: String) In presenter, I am accessing Android.Request("Lollipop") and getting response. The real question is when view(Fragment) is replaced by another view(Fragment), Android object would be in memory until application gets closed or would be garbage collected when view and associate presenter references are gone.
    r
    • 2
    • 1
  • p

    pgreze

    06/21/2018, 3:36 AM
    top level methods are useful when writing Util classes. Example: https://github.com/TonnyL/Light/blob/master/light/src/main/java/io/github/tonnyl/light/Light.kt
    • 1
    • 1
  • c

    changhyun

    06/21/2018, 10:31 AM
    android:layout_marginRight="@{rankingItemViewModel.marginLeftOrRight ? 0: 100}"
    Anyone can teach me what is wrong??….
    :stackoverflow: 2
    g
    j
    r
    • 4
    • 24
  • b

    brainail

    06/21/2018, 11:28 AM
    Hey everyone, I was wondering, how do you deal with the following issue: https://youtrack.jetbrains.net/issue/KT-8628 ? It’s about inline stuff and the fact that all line numbers in a stacktrace are shifted and greater than number of lines in a file. Also debugging seems like doesn’t work properly and don’t step into inline stuff easily (only if you do it manually). Did anyone meet the same issues? What is the best solution here? As an option all inline stuff should be massively tested to avoid crashes and don’t contain complex logic to avoid debugging… Thanks
    f
    • 2
    • 3
  • j

    juhanla

    06/21/2018, 11:35 AM
    So in Kotlin a == b should translate to a?.equals(b) ?: (b === null) . However comparing resources (resource == R.string.xxxx) seems to always return false even though manually stating resource.equals(R.string.xxxx) compares correctly. Why is that?
    l
    • 2
    • 4
  • s

    Seri

    06/21/2018, 2:49 PM
    Does Kotlin’s view binding work with layouts located in other modules? I’m getting the error
    Unresolved reference: account_card
    from the following line:
    import kotlinx.android.synthetic.main.account_card.view.*
    There was a similar 😒tackoverflow: question posted a few months ago, but it didn’t get any response. https://stackoverflow.com/questions/48808542/android-kotlin-kotlinx-module-level-view-binding
    r
    p
    • 3
    • 8
  • a

    Ayden

    06/21/2018, 3:25 PM
    Hi guys. Anyone of you store your .AndroidStudio and .gradle in other drive?
    h
    • 2
    • 2
  • c

    changhyun

    06/22/2018, 5:41 AM
    android:layout_gravity="@{rankingItemViewModel.marginLeftOrRight  ? Gravity.RIGHT : Gravity.LEFT}"
    Any one can tell me why its not working?
    g
    m
    r
    • 4
    • 20
  • a

    alex2069

    06/25/2018, 5:25 AM
    Add
    @file:Module
    ?
    u
    • 2
    • 1
  • g

    Gta

    06/25/2018, 1:02 PM
    @lawlorslaw silly question. From what I know,
    onSuccess
    ,
    onError
    and
    onComplete
    are exclusive on
    Maybe
    . Did you try to log on
    onComplete
    ?
    l
    • 2
    • 2
  • h

    Hele

    06/25/2018, 3:09 PM
    kotlin.TypeCastException: null cannot be cast to non-null type android.support.v7.widget.RecyclerView
    r
    • 2
    • 1
  • h

    Hele

    06/25/2018, 3:12 PM
    I created row
    n
    • 2
    • 70
  • h

    Hele

    06/26/2018, 6:52 PM
    yeah I will definitely check them thanks
    n
    g
    • 3
    • 7
  • t

    Tyler

    06/26/2018, 7:01 PM
    ok so I've got something weird going on and IDK how to fix it, I have an activity with a recyclerview and a navigation drawer, but when the drawer is first in the XML the recyclerview stays on top, and when the recyclerview is first in XML the you can't interact with it and the drawer works perfectly
    r
    • 2
    • 1
  • m

    martynas

    06/27/2018, 6:39 AM
    How can I exclude value from
    @Parcelize
    ? I have a class where
    Bar
    is 3rd party library class.
    data class Foo(
      val id : Int = 0,
      val bar : Bar? = null
    )
    At compile time I get
    Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'
    on
    Bar
    . That is fine by me. I’m happy to lose that value. But no combination of
    @IgnoredOnParcel
    and
    @RawValue
    did not worked for me yet - runtime error when serializing value.
    l
    k
    • 3
    • 13
  • k

    Kevin Janvier Chinabalire

    06/27/2018, 8:30 AM
    Hey Guys ... I need help .. I have an app which was build Using Eclipse , I rewrote the app in Kotlin using Android Studio ... am having a challenge Generating a singed apk .. the alias key
    No key with alias
    not found
    found in keystore
    am using the same one i used in android studio..
    :stackoverflow: 4
    g
    • 2
    • 4
  • d

    dalexander

    06/27/2018, 5:41 PM
    Probably Dagger 2? But some devs have found dependency injection is less useful on Kotlin projects, so you might consider whether you need it or not.
    c
    u
    • 3
    • 3
  • a

    alex2069

    06/28/2018, 2:59 AM
    The
    get()
    results in it being created at call-time (and each time something accesses
    httpLogging
    ). Without the
    get()
    it's kind of like a constant field that is initialized once when the class is constructed with each access to
    httpLogging
    returning that value.
    c
    • 2
    • 1
  • a

    alex2069

    06/28/2018, 3:02 AM
    You could try to compare it as well - go to the val and use "Show Kotlin Bytecode" - then hit the "Decompile to Java" button and compare the implementations
    c
    • 2
    • 1
  • a

    Ayden

    06/28/2018, 6:19 AM
    Hi guys. Recently I'm trying to create my project by using MVVM.
    j
    • 2
    • 1
  • a

    Ayden

    06/28/2018, 6:19 AM
    May I know what's the different between
    model
    and
    repository
    directory?
    l
    • 2
    • 5
  • e

    edwardwongtl

    06/28/2018, 10:51 AM
    I think the only Kotlin specific thing for android is the Kotlin-android extension, which you can read more from the official website
    ✔️ 1
    ☝️ 1
    d
    r
    g
    • 4
    • 8
  • c

    chi

    06/28/2018, 6:48 PM
    Converting the following to java snippet
    backgroundPaint.setColor(0xffff0000);
    to kotlin results in
    backgroundPaint.color = -0x10000
    . I wouldn't have been able to know how to get that hex color int on my own without the IDE conversion, please what is going on there so I can be able to reproduce it on my own?
    l
    m
    • 3
    • 5
  • e

    eygraber

    06/28/2018, 7:11 PM
    Is it safe to set the kotlin compile target to 1.8 if min version is 24?
    g
    • 2
    • 1
Powered by Linen
Title
e

eygraber

06/28/2018, 7:11 PM
Is it safe to set the kotlin compile target to 1.8 if min version is 24?
g

gildor

06/29/2018, 10:20 AM
Should be fine. API level 24 supports Java 8
View count: 1