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

    jw

    10/20/2018, 11:47 PM
    https://github.com/JakeWharton/SdkSearch/commit/d2c10e1d680fe9b1fb4f1a008f4f1086a55dbb88
    s
    k
    • 3
    • 2
  • u

    ursus

    10/21/2018, 2:23 PM
    @Paul Woitaschek whats the point, build perf?
    p
    g
    • 3
    • 9
  • s

    serepasf

    10/22/2018, 12:46 AM
    Hello ,there is any specific way to take a photo and save it with specific name for example temp.jpg??
    :google: 1
    :stackoverflow: 4
    e
    • 2
    • 1
  • s

    serepasf

    10/22/2018, 8:04 AM
    If i didnt metion ...first I try anything which I find in stackoverflow and in other sites
    u
    e
    • 3
    • 2
  • j

    Jakub

    10/22/2018, 8:53 AM
    -.js
    e
    • 2
    • 2
  • p

    pablisco

    10/22/2018, 10:57 AM
    We are getting a very strange bug. Anybody had a similar experience? https://stackoverflow.com/questions/52927675/static-final-field-is-null-when-it-shouldnt
    d
    e
    • 3
    • 6
  • e

    Egor Trutenko

    10/22/2018, 12:02 PM
    Oh, right, you need album id to fetch photos, I didn't notice, sorry
    s
    • 2
    • 1
  • l

    leolima

    10/22/2018, 12:07 PM
    something like
    fetchAlbums().flatMap { album -> fetchPhotos(album.id).map { photos -> album to photos } }
    would give you a pair of album / photos
    s
    • 2
    • 6
  • j

    Jakub

    10/22/2018, 12:22 PM
    I tried above code, unfortunately, I can’t get reference to
    dialog
    in my
    onClickListener
    . Do you have any idea how to solve it?
    e
    • 2
    • 2
  • s

    serepasf

    10/23/2018, 8:02 AM
    Hello I an activity with two buttons. First I take a photo and in override onactivityresult I upload the photo in firebase and I get an url which I save to photoUrl . Then in the other btn listener inside oncreate I want to use this variable but I get null as I define it in the begin of the class. How can I get the value of photoUrl which I want? https://gist.github.com/spartakos87/e0d492c7f2a9af76638bb50d05a30a46
    :stackoverflow: 8
    e
    • 2
    • 2
  • s

    Soundlicious

    10/23/2018, 8:41 AM
    i'm having a nice infinite loop 😥
    e
    • 2
    • 2
  • s

    Santhosh

    10/23/2018, 9:53 AM
    can anyone send custom camera2 tutorial?
    :stackoverflow: 4
    :google: 2
    l
    • 2
    • 2
  • g

    greybeard1123

    10/23/2018, 11:32 AM
    I heard from a level 5 engineer at Google today “The use of reactive programming is ill-advised in Android development because of known issues that it generates in the area of lifecycle complications/potential leaks. Also, Kotlin is supported as a first class language largely as a shorthand for those who prefer it when writing third-party applications” This is his argument on why we should move our application to framework and use java/native code only. @jw is this the reason why we wont be seeing Kotlin support in AOSP anytime in the future?
    🤔 3
    :trollface: 2
    y
    e
    +4
    • 7
    • 8
  • j

    jw

    10/23/2018, 1:24 PM
    So many things to unpack there: - Their thoughts on reactive programming show a large gap in knowledge. All of Android is reactive programming since everything is callback and lifecycle-based and yes it can cause leaks. Android has forced reactive programming to be the only viable solution because of it's lifecycle and callbacks models and thus forced leaks on itself. Whether you choose to deal with it manually, with coroutines, with Rx, or with something else is irrelevant. Those are just higher-level abstractions. You cannot write an Android app without reactive programming principles since nearly everything on the system is asynchronous. I suspect they're just an RxJava hater. - Kotlin was definitely supported primarily for third-party applications. Google's first-party apps are generally irrelevant since they use a bespoke build system and bespoke suite of libraries unlike how normal apps are developed. I know a lot of people like to base decisions on whether Google uses things, but they represent 0.01% of the Android developer ecosystem and so they contribute 0.01% to decisions made. I would recommend ignoring them. That being said, there's already first-party apps using Kotlin and work is being done to support more. The Bazel team is developing Kotlin rules in the open on GitHub if you're interested. I suspect they're just a Kotlin-hater. - AOSP is big so "Kotlin support in AOSP" is ill-defined. Support for Kotlin was added to the (yet another bespoke) build system of AOSP a year ago. I don't know if any packages are using it or not. It's definitely being used in some of the tooling. And of course, the AndroidX libraries are developed in AOSP and they have a ton of Kotlin in them. If you're talking about the framework, it doesn't really make sense to put Kotlin in the framework as it would lock the standard library to that version and we would have the same problem we do with other platform APIs. And if you jarjar it out of the public package, then what advantage are you bringing?
    👍 32
    🔥 3
    m
    r
    h
    • 4
    • 6
  • n

    nmthompson

    10/23/2018, 3:07 PM
    can I self reference in the let block?
    h
    • 2
    • 3
  • a

    amanda.hinchman-dominguez

    10/23/2018, 4:59 PM
    running a minute behind
    🏃‍♂️ 1
    r
    • 2
    • 3
  • s

    Slackbot

    10/23/2018, 6:00 PM
    This message was deleted.
    :stackoverflow: 2
    r
    • 2
    • 1
  • t

    Travis Griggs

    10/23/2018, 8:54 PM
    @greybeard1123 just for my curiosity… what is a Level 5 Engineer at Google? Is that better than a Level 1? Are there Level 42 Engineers? (while this may sound a humorous D&D-ification, I’m not a Google-yte, so I honestly don’t have a clue how to put the Level 5 in context)
    c
    v
    • 3
    • 2
  • t

    temp_man

    10/23/2018, 10:59 PM
    I can’t seem to find an example of a when statement with int ranges. Like when(myInt) { 0..1 ->{doStuff()}}
    v
    • 2
    • 2
  • u

    ursus

    10/23/2018, 11:26 PM
    lmao that comment about rx, whats next, dont write unit tests because only bad devs make bugs? 😄 rx is amazing, general android app code is much better because of it, and actually handles much more, where before race conditions would be yolo and only fixed when bugs reported etc. or doing stuff from callback of something else, that needs certain conditions to happen. before this would be if !conditionsOk return, and yolo most of the time
    l
    r
    r
    • 4
    • 76
  • e

    erikmedina

    10/24/2018, 11:45 AM
    Hello there! do you know if there are specific Kotlin options to show logs in Android? With Java, I used to use Timber but I'd like to know if there are more "Kotlin" options. Thank you.
    t
    s
    +4
    • 7
    • 11
  • j

    jurajsolarml

    10/24/2018, 2:38 PM
    Hello,please help 😞 I am beginner.How do I fix it? Thanks https://hastebin.com/puxuxabosa.cpp
    e
    m
    a
    • 4
    • 8
  • j

    jw

    10/24/2018, 5:22 PM
    because you should never use toasts!
    🙂 1
    b
    • 2
    • 2
  • r

    rajkumar

    10/25/2018, 12:55 AM
    What is the recommended online course to start Kotlin, for experienced Android developers?
    t
    • 2
    • 2
  • t

    ti4n

    10/25/2018, 2:22 AM
    The kotlin plugin was broken in the Android studio 3.4 canary2 built with 183.2
    👍 1
    a
    • 2
    • 1
  • j

    Jason

    10/25/2018, 6:28 AM
    Hello guy What is the best way to every 2 minute send a request to server to get latest data ?
    :stackoverflow: 10
    t
    r
    p
    • 4
    • 3
  • c

    CamilleBC

    10/25/2018, 10:38 AM
    Hello, since I've updated to kotlin v1.3.0-rc, the android studio IDE doesn't recognize
    kotlinx-android-extensions
    . I'm using Android Studio v3.2.1 (Build #AI-181.5540.7.32.5056338). If I comment out the plugin, then sync, then un-comment, and resync, the plugin works again. Any idea how I could solve that?
    a
    • 2
    • 9
  • s

    Sergio Crespo Toubes

    10/25/2018, 3:05 PM
    ProgressDialog is deprecated then what is the best way thinking in ux to help users about an action. I am talking about a register form for example. Thanks !!
    a
    g
    • 3
    • 4
  • u

    ursus

    10/25/2018, 4:55 PM
    not everyone is using Fragments, which is what the probably had in mind when deprecating it
    r
    g
    • 3
    • 9
  • m

    Matt Rea

    10/25/2018, 8:52 PM
    what is your
    single
    declaration in your module? If you’re doing
    single<ComponentA>()
    , I would change it to
    single { ComponentA(get(), get()) }
    . Omitting parameters and having koin find them is experimental. As far as I can tell from the source code its based on reflection https://github.com/InsertKoinIO/koin/blob/e159f2dd845990a9b5588d142692d132d7597708/koin-projects/koin-core/src/main/kotlin/org/koin/core/instance/InstanceHolder.kt Here’s a Retrofit example in my app
    val networkModule: Module = module {
        single { createWebApi<AuthApi>(get<NetworkClient>().defaultRetrofit) }
        single { createWebApi<MapBoxApi>(get<NetworkClient>().mapBoxRetrofit) }
    }
    inline fun <reified T> createWebApi(retrofit: Retrofit): T = retrofit.create(T::class.java)
    👍 1
    g
    • 2
    • 1
Powered by Linen
Title
m

Matt Rea

10/25/2018, 8:52 PM
what is your
single
declaration in your module? If you’re doing
single<ComponentA>()
, I would change it to
single { ComponentA(get(), get()) }
. Omitting parameters and having koin find them is experimental. As far as I can tell from the source code its based on reflection https://github.com/InsertKoinIO/koin/blob/e159f2dd845990a9b5588d142692d132d7597708/koin-projects/koin-core/src/main/kotlin/org/koin/core/instance/InstanceHolder.kt Here’s a Retrofit example in my app
val networkModule: Module = module {
    single { createWebApi<AuthApi>(get<NetworkClient>().defaultRetrofit) }
    single { createWebApi<MapBoxApi>(get<NetworkClient>().mapBoxRetrofit) }
}
inline fun <reified T> createWebApi(retrofit: Retrofit): T = retrofit.create(T::class.java)
👍 1
g

GurpreetSK

10/26/2018, 6:22 AM
Thanks a lot! This helped. Can you point to some resource where I can read more about this?
View count: 4