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

    Tim

    11/11/2019, 2:56 PM
    whats the difference between these two ways of instantiating a string?
    j
    r
    +3
    • 6
    • 9
  • n

    nitrog42

    11/12/2019, 9:41 AM
    Hello everybody, does someone know if there is a way to enable the coroutine debug mode on android/android studio ? (https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/debugging.md)
    g
    m
    • 3
    • 6
  • n

    Nir Golan

    11/12/2019, 3:47 PM
    hey all have anyone worked with moshi retrofit and pairs and lived to survive?
    c
    d
    • 3
    • 7
  • d

    dave08

    11/13/2019, 2:07 PM
    r8 is finishing with an error:
    Error: Attribute Signature requires InnerClasses attribute. Check -keepattributes directive.
    What could cause this?
    s
    • 2
    • 2
  • a

    Aiden

    11/14/2019, 8:52 AM
    I thought I should have to use async and await for this.
    f
    • 2
    • 1
  • a

    Aslam Hossin

    11/14/2019, 1:36 PM
    Is there any
    android
    opensource
    library
    for getting external storage image resources?
    a
    v
    • 3
    • 3
  • t

    Tim

    11/14/2019, 4:23 PM
    is there some threshold on how many broadcasts you can send in a time period with LocalBroadcastManager
    :stackoverflow: 3
    a
    • 2
    • 1
  • a

    Aiden

    11/15/2019, 6:58 AM
    How do I use MainActivity to trigger this MainViewModel to run?
    p
    l
    • 3
    • 2
  • c

    Cyberpunk Keanu

    11/15/2019, 10:41 AM
    Hey all. I have a bottom navigation with 5 tabs But I'm using 6 Fragments. The first one is displayed by default when the activity is loaded. Then the rest 5 fragments are assigned to the 5 tabs in my bottom navigation. Now here is my ideal scenario. 1st Fragment always stays in the back stack. Then even if you keep switching between the 5 tabs, on back pressed should go to the 1st default fragment. However, idk how to do it & hence a result I now have a backstack of all the tabs that I switched in between. Anyone idea how to handle this back stack? I just want to go to the 1st Fragment on back/up press & not into a never ending backstack of tabs I switched.
    c
    g
    • 3
    • 4
  • c

    Cyberpunk Keanu

    11/15/2019, 12:46 PM
    Anyone know how to write an inline Intent outside of an OnClickListener Lambda? I know inside the lambda, you can write like this
    view.setOnClickListener { v->
        v.context.startActivity(Intent(v.context, NextClass::class.java))
    }
    but if I try to write it outside the lambda, I get an error saying that Intent needs a FLAG_CLEAR_NEW_TASK. But Idk where to put it? Any suggestions?
    t
    • 2
    • 2
  • a

    Abhishek Bansal

    11/15/2019, 4:35 PM
    Hey guys did anybody happen to stumble upon this? Is there a workaround that is available? It seems like Android Gradle test plugin(
    com.android.test
    ) is broken after `AndroidX `as demonstrated in official testing blueprints. https://issuetracker.google.com/issues/129421689
    t
    • 2
    • 2
  • m

    mending3

    11/16/2019, 3:01 PM
    why is action my action bar showing the title as fragment name? for example if I'm in HomeFragment, the action bar title is HomeFragment etc
    a
    a
    • 3
    • 8
  • c

    codebijan

    11/16/2019, 5:25 PM
    Anyone know best way to go about making a network layer in Kotlin? I have a backend REST api with several endpoints and a base URL and would like to know best practices for creating a network layer in Kotlin, much appreciated.
    a
    • 2
    • 3
  • s

    Sebi Sheldin Sebastian

    11/17/2019, 5:17 AM
    Is there a Jetpack compose channel?
    i
    • 2
    • 2
  • c

    Cyberpunk Keanu

    11/17/2019, 3:54 PM
    Can someone help me with Recyclerview layouts. What I'm trying to achieve is a Horizontal recyclerview, with a single row, & fit atleast 2 items in the total horizontal screen width. My issue, the item populating in the recyclerview take the width of the whole screen show it is only showing 1 item. If my primary condition wasn't for it to be a Horizontal scroll, I would've just used
    recyclerview.layoutManager = GridLayoutManager(context, 2)
    But this code by default makes the Grid layout scroll vertically. And if I add
    (context, 2, GridLayoutManager.HORIZONTAL, false)
    it adds 2 rows instead of 2 items in a row, but it does scroll Horizontal. Help? (P.S. It is important that the solution given scrolls the recyclerview Horizontally 🙏) Edit: A good example of what I'm trying to achieve would be this playstore's implementation of horizontal recyclerview. My items take the whole screen width unlike shrinking & thus effectively showing 2 items at once
    m
    • 2
    • 2
  • j

    J6ey

    11/18/2019, 12:06 AM
    Has any of you actually been coding on the standard close or similar to how the Sunflower app is built?
    a
    n
    • 3
    • 2
  • j

    J6ey

    11/18/2019, 12:08 AM
    I thought kotlin was just a change in syntax but there seems to be features and practices in store
    a
    m
    • 3
    • 3
  • n

    Nikola Milovic

    11/18/2019, 9:05 AM
    Dagger2, tests fail because lateinit not initialized
    @Module(includes = [TestApplicationModuleBinds::class])
    object TestApplicationModule {
        @set:Inject
        lateinit var mockQuoteDataSource : MockQuoteDataSource
    class MockQuoteDataSource @Inject constructor(jsonNetworkService: JsonNetworkService) : TestQuoteRemoteDataSource(jsonNetworkService.apiService) {
    I get the error
    kotlin.UninitializedPropertyAccessException: lateinit property mockQuoteDataSource has not been initialized
    t
    • 2
    • 4
  • q

    quver

    11/18/2019, 3:21 PM
    Hello, guys. does anyone use/love
    Android Paging Library
    ? Personally I think that mostly people wish to get rid of boilerplate code and get simpler solution. And now it looks kinda overhead because you need to write more that just
    DiffUtil
    +`LoadMorelistener`. Any thoughts about it, does it really worth it?
    c
    w
    • 3
    • 13
  • p

    Paul Woitaschek

    11/18/2019, 9:43 PM
    Ehh what? Not verified? Why does it has to be verified?
    i
    y
    • 3
    • 5
  • j

    JD

    11/19/2019, 5:02 AM
    Question on Android navigation library aka single activity pattern. Is it intended to have your entire app defined by the single activity or would it actually be better to have multiple navigation for various different modules like authentication, home, may be a product list (including flows till product checkout). Has anyone used it in production app so far. Any pointers would be helpful.
    :stackoverflow: 2
    :google: 2
    a
    s
    c
    • 4
    • 12
  • t

    Tim

    11/19/2019, 2:35 PM
    does android development tend to rely more on 3rd party libraries as compared to iOS development?
    s
    p
    +3
    • 6
    • 7
  • d

    dakinne

    11/19/2019, 3:39 PM
    fun newInstance(
                onSizeSelected: () -> Unit = {}
            ) = SizesFragment().apply {
                arguments = Bundle().apply {
                    putSerializable(ON_SIZE_SELECTED, onSizeSelected )
                }
            }
    p
    d
    • 3
    • 3
  • a

    Adam Powell

    11/19/2019, 5:06 PM
    generally speaking you can't/shouldn't.
    👍 4
    p
    j
    • 3
    • 6
  • a

    Abdul Samad

    11/20/2019, 11:55 AM
    Hello, what's the best option to store and secure your API keys ?
    :google: 1
    :stackoverflow: 2
    o
    f
    +6
    • 9
    • 41
  • m

    Mohammed Alaa

    11/20/2019, 7:01 PM
    Hi guys, I was wondering if there exist something for JSON parsing that work with Retrofit in android like Codable Protocol in ios Swift that allow dynamic json parsing ,or I should create my own JSON converter for every type?
    c
    a
    +2
    • 5
    • 24
  • c

    Cyberpunk Keanu

    11/21/2019, 4:26 AM
    Guys, which dependency injection framework is better? Dagger 2 or Koin? Now that our app is going to scale, I feel like we're going to have a need for dependency injection in it
    d
    r
    +4
    • 7
    • 18
  • d

    dave08

    11/21/2019, 1:09 PM
    Is there some kind of coroutine scope already handled by Android Lifecycle components for Services and IntentServices?
    a
    d
    • 3
    • 11
  • r

    rkeazor

    11/21/2019, 1:40 PM
    There is lifecycle scope, that works with lifecycle owner I believe
    d
    • 2
    • 5
  • h

    hikkidev

    11/21/2019, 4:03 PM
    Ladies and Gentlemen, whoever faced a similar problem? I am using Android Studio 4.0 Canary 4 and when using kotlinx.synthetic I get NPE
    l
    s
    +2
    • 5
    • 14
Powered by Linen
Title
h

hikkidev

11/21/2019, 4:03 PM
Ladies and Gentlemen, whoever faced a similar problem? I am using Android Studio 4.0 Canary 4 and when using kotlinx.synthetic I get NPE
l

Luca Nicoletti

11/21/2019, 4:03 PM
You sure you’ve included the right file?
kotlinx.synthetic
can point to the wrong file if the same id is used in several
xml
files
h

hikkidev

11/21/2019, 4:07 PM
@Luca Nicoletti yes
this is - ok
Got NPE, button_save is null
On Android studio 3.5.2 everything works as it should...🤔
s

Sebi Sheldin Sebastian

11/21/2019, 4:29 PM
What's your gradle version and the kotlin version? Kotlin EAP might be screwing things up a little
I just checked on the latest Canary build with Kotlin 1.3.60 and gradle 4.0.0-alpha04 and all my view holder synthetics are working fine, the only difference from yours is I'm not using Moxy
h

hikkidev

11/21/2019, 5:04 PM
I found a problem.
gradle-wrapper.properties: distributionUrl=******/*gradle-6.0-rc*-*.zip It is necessary to use the stable version =) On gradle-6.0-all.zip - everything is ok
z

Zach Klippenstein (he/him) [MOD]

11/21/2019, 7:26 PM
Something to keep in mind for the future, there are also women in this slack, not just gentlemen 😉
i

itnoles

11/21/2019, 11:46 PM
I am suprising you are not using Jetpack Compose on AS 4.0
h

hikkidev

11/22/2019, 6:04 AM
@itnoles While exploring Jetpack Compose)
@Zach Klippenstein (he/him) [MOD] Yes you are absolutely right 😅
View count: 1