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

    itnoles

    03/01/2019, 4:11 PM
    One Android Engineers said "We do not recommend switching to build.gradle.kts yet"
    🤔 1
    g
    l
    +2
    • 5
    • 8
  • m

    matt tighe

    03/01/2019, 8:04 PM
    What’s the best way to accomplish manual dependency injection into viewmodels? The following leads to
    Unchecked cast: MyViewModel to T
    , which leads me to believe there may be a better way
    class MyViewModel(private val myDependency: MyDependency) : ViewModel() {}
    
    class MyViewModelFactory(private val myDependency: MyDependency) : ViewModelProvider.NewInstanceFactory() {
        override fun <T: ViewModel?> create(modelClass: Class<T>): T {
            return MyViewModel(myDependency) as T
        }
    }
    
    // In activity
    private val myViewModel: MyViewModel by lazy {
        val myDependency = MyDependency()
        ViewModelproviders.of(this, MyViewmodelFactory(myDependency))
            .get(MyViewModel::class.java)
    }
    l
    b
    • 3
    • 4
  • j

    jw

    03/01/2019, 8:21 PM
    yeesh. view models have ruined what should otherwise be a trivial operation.
    👍 4
    😂 8
    🙃 8
    ➕ 1
    😃 2
    g
    p
    +12
    • 15
    • 91
  • k

    kd

    03/01/2019, 9:42 PM
    I am trying to implement a very simple RecyclerView. I am using DiffUtil to calculate the diff between the original and modified list. The problem I am facing is the original and modified list are always the same. I understand it’s a issue related to list references but cannot figure out what can I change. I have tried creating a newList (new reference) every-time something is updated. What am I missing?
    -.kt
    e
    • 2
    • 1
  • s

    scottiedog45

    03/02/2019, 8:54 PM
    Hi everyone - is Anko a given for most android projects? I’m a beginner and don’t like being too abstracted from what’s going on. But if it’s part of the canon for android development then I think it would be fine to use.
    l
    a
    d
    • 4
    • 5
  • d

    dangvh

    03/03/2019, 4:18 AM
    Hey Guys, I have problem with kotlin android and retrofit 2, rxjava That is "Caused by: kotlin.UninitializedPropertyAccessException: lateinit property compositeDisposable has not been initialized"
    t
    r
    • 3
    • 3
  • n

    no

    03/03/2019, 10:39 PM
    how do you define “safe”?
    c
    j
    r
    • 4
    • 4
  • j

    jw

    03/03/2019, 11:27 PM
    When the runner beats the ball to the plate ⚾
    ⚾ 8
    t
    • 2
    • 1
  • i

    Ive Vasiljevic

    03/04/2019, 12:54 PM
    does anyone have a good article explaining how to use retrofit with coroutines and MVVM architecture
    n
    • 2
    • 4
  • r

    ribesg

    03/04/2019, 1:23 PM
    Is there a good Kotlin wrapper for the Google Play Services Location API mess?
    b
    l
    • 3
    • 25
  • z

    zachtib

    03/04/2019, 1:50 PM
    I'm working with an api that returns either
    { "data": { ... } }
    or
    { "error": { ... }}
    for all of its calls. Are there any examples out there for modeling this using a sealed class w/ Retrofit
    d
    • 2
    • 2
  • z

    zachtib

    03/04/2019, 1:52 PM
    OK, that makes sense. Am I probably going to be looking at writing some sort of custom response converter for this, or can one of kotlinx.serialization/Moshi/Gson handle this somewhat automatically?
    n
    • 2
    • 1
  • d

    dvlwj

    03/05/2019, 2:26 AM
    guys, any tips for me? im still a junior dev, and its already 1 year i spent on android dev. but idk why, i keep write my android apps with procedural mindset.
    l
    r
    • 3
    • 5
  • i

    Ive Vasiljevic

    03/05/2019, 9:52 AM
    Should I use view model to start other activities and/or show toast messages by sending context to view model through methods: from activity -> myVm.someMethod(applicationContext), from view model -> someMethod(applicationContext) { startActivity(Intent(applicationContext...))}
    :google: 1
    a
    j
    b
    • 4
    • 3
  • i

    Ive Vasiljevic

    03/05/2019, 12:44 PM
    Excuse me for so many questions, but I just started developing with kotlin. I am using okhttp3 interceptor to add new headers to requests. Since I have two types of request I have two instances of retrofit builder with different interceptors. On POST request my header content-type: application/json is doing just fine, but when I add my header x-access-token to DELETE request it refuses to add that header on request and I don't know why. I am using retrofit, coroutines, logging interceptor, header interceptor and JakeWharton/retrofit2-kotlin-coroutines-adapter.
    ✔️ 1
    :stackoverflow: 4
    r
    • 2
    • 2
  • d

    dave

    03/05/2019, 3:34 PM
    Have any of you ever changed the language in runtime while running espresso tests? We are trying to automate the screenshot generation for our app in all the available languages, yet local changes are not reflected in the UI. Ideas?
    j
    b
    • 3
    • 7
  • b

    Bilagi

    03/05/2019, 6:42 PM
    stable version of
    work manager
    released ? Earlier it was beta, are they released stable version ?
    t
    • 2
    • 2
  • d

    Dave Leeds

    03/05/2019, 8:04 PM
    Hey all - I’m using coroutines version 1.1.1, and on Android 5.0, I get this message:
    Rejecting re-init on previously-failed class java.lang.Class<kotlinx.coroutines.CoroutineExceptionHandlerImplKt>
    The app doesn’t crash, but I’ve got a
    deferred.await()
    that never seems to resume. There’s no other exception information following this message in the logs. Also, I’ve only seen this happen on Android 5.0 - even Android 5.1 seems to work fine. Has anyone else run into this?
    n
    • 2
    • 1
  • d

    dangvh

    03/06/2019, 4:50 AM
    I'm a newbie Android, I want to join the project ti improve my skill. Anybody help me ?:(
    b
    t
    • 3
    • 2
  • m

    maxmello

    03/06/2019, 12:52 PM
    Are there examples of how to strip away a top level Kotlin extension function (with default parameter) with proguard? Right now I have the following:
    -assumenosideeffects class com.example.package.ExtensionsKt {
        public static void myFunction(...);
    }
    The function is defined as follows:
    fun Any.myFunction(param1: String, param2: Throwable? = null) {
        ...
    }
    But it does not work sadly, I also tried the following (method signature copied from mapping.txt) which also does not work:
    -assumenosideeffects class com.example.package.ExtensionsKt {
         public static void myFunction(java.lang.Object,java.lang.String,java.lang.Throwable);
         public static void myFunction$default(java.lang.Object,java.lang.String,java.lang.Throwable,int,java.lang.Object);
    }
    t
    • 2
    • 2
  • r

    ribesg

    03/06/2019, 3:03 PM
    It looks like
    androidx.core.view.doOnPreDraw
    does not get called if the view is created while the device is locked, is it a known issue? Is there a workaround?
    :google: 2
    • 1
    • 2
  • o

    Oleh Ponomarenko

    03/06/2019, 4:46 PM
    Hello guys! Please help me with Coroutines. I need to implement this: 1. Run my task in background mode 2. Stop the task in 30 seconds 3. Delay 10 seconds. 4. Repeat my cycle (1-3 points) infinitely https://prntscr.com/mu5xin (detailed on a picture)
    g
    s
    • 3
    • 4
  • a

    amadeu01

    03/06/2019, 6:18 PM
    hi guy, what do you use for autocorrect indentation? and code style?
    g
    l
    • 3
    • 2
  • m

    mzgreen

    03/07/2019, 7:07 AM
    What is the reason for
    @Parcelize
    still being experimental? When will it become stable? Are there still some bugs that needs to be fixed?
    g
    z
    j
    • 4
    • 6
  • b

    Bilagi

    03/07/2019, 7:46 AM
    I have data class which contains non nullable parameters like
    first_name
    ,
    last_name
    etc also using
    Gson
    for parsing. Suppose server doesn't send any one of the key value. I am expecting app should crash but it is not crashing. When i degug value is
    null
    .Any one knows what is the reason ?
    m
    a
    • 3
    • 5
  • s

    sorianog

    03/07/2019, 12:01 PM
    Saw that there was no Kotlin equivalent for the "Introduction to Sceneform" Codelab so I decided to re-write it! Here is my attempt: https://github.com/sorianog/ARStickers
    👍 2
    b
    • 2
    • 3
  • c

    CarlosBlanco

    03/07/2019, 10:32 PM
    but its when i press back button
    a
    • 2
    • 2
  • p

    Paul Woitaschek

    03/08/2019, 7:17 AM
    Can someone confirm putting this anywhere in your project destroy sth in androids dex format and your app crashes on start?
    g
    a
    • 3
    • 8
  • s

    Schadenfreude

    03/08/2019, 4:53 PM
    Hey guys, I have a Kotlin class with some reified and equivalent normal functions:
    // Java fun
    fun <T:E> registerEvent(cls:Class<T>, consumer: Consumer<T>) : Disposable {
            return this.listen(cls)
                .subscribe(consumer)
        }
    
    // Kotlin fun (calls the java one)
    inline fun <reified T:E> registerEvent(consumer: Consumer<T>): Disposable {
            return registerEvent(T::class.java, consumer)
        }
    In java I have no problem calling
    registerEvernt(SomeClass.class, this::consumerMethod)
    , but in Kotlin, when I try to do a method reference for the consumer, the compiler gives me an error and says it returns a
    KFunction1<SomeClass, Unit>
    and the required parameter is
    Consumer<SomeClass>
    . Is there any way I can make the functions behave the same, or is the
    inline
    or something else making it impossible?
    s
    • 2
    • 4
  • t

    tapchicoma

    03/11/2019, 1:43 PM
    Does anyone can provide me a link to some example of shared UI tests between Android and iOS?
    g
    • 2
    • 3
Powered by Linen
Title
t

tapchicoma

03/11/2019, 1:43 PM
Does anyone can provide me a link to some example of shared UI tests between Android and iOS?
g

gumil

03/11/2019, 2:06 PM
I think this should be done with test automation tools
t

tapchicoma

03/11/2019, 2:08 PM
my idea is to have shared robot interfaces/test cases that uses robots and actual robot interfaces implementations on each platform. In first glance should be possible, though would be nice to see if there are already such implementations
g

gumil

03/11/2019, 2:43 PM
That’s a really good idea. Never thought of it that way
View count: 3