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

    Paul Woitaschek

    11/14/2018, 2:59 PM
    How do you handle dagger components in gradle modules? I can use a sub-component and everything is fine - however often I don't want to expose the dependencies of my library gradle modules. How do you do that?
    r
    1 reply · 2 participants
  • u

    uhe

    11/14/2018, 3:07 PM
    I keep dagger out of my library modules
    👍 1
    d
    p
    +5
    24 replies · 8 participants
  • j

    jishindev

    11/15/2018, 4:22 PM
    Can kotlin contracts be used for methods that do permission checks? Couldn't find any detailed doc regarding this.
    g
    r
    +1
    10 replies · 4 participants
  • d

    dylan

    11/16/2018, 9:49 AM
    anyone know where I can find the implementation the binding adapter that is used for the recyclerview
    app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
    already look in
    androidx.databinding:databinding-adapters
    but its not there
    g
    3 replies · 2 participants
  • c

    CamilleBC

    11/16/2018, 1:05 PM
    Hello! Is there any good way to pass the application context to an object? I have a service that interfaces with an API. I think it would be ok for it to be a singleton, as it looks more like a manager than a generic class. Should I create a method
    fun init(application: Application) {//do stuff}
    or is there a better way?
    😜 1
    a
    i
    +3
    24 replies · 6 participants
  • j

    jurajsolarml

    11/16/2018, 3:32 PM
    Hello please help.I am a beginner. I've tried trying ways to initialize Firebase still bugging me but I can not find it where it can be.AS, 3.2.1 Thank you https://hastebin.com/vaficulena.cs https://hastebin.com/javidimawa.cpp
    :stackoverflow: 4
    d
    t
    +1
    8 replies · 4 participants
  • i

    igor.wojda

    11/17/2018, 11:29 PM
    Is there any docs listing all the extension present in Android KTX?
    l
    s
    +1
    13 replies · 4 participants
  • p

    Paul Woitaschek

    11/18/2018, 7:58 AM
    Is configure on demand also not present at all in AS 3.2 for you? https://developer.android.com/studio/build/optimize-your-build#configuration_on_demand
    g
    4 replies · 2 participants
  • p

    Paul Woitaschek

    11/18/2018, 12:39 PM
    Has someone experiences with the compiler Json serialization? How ready for production is it?
    g
    j
    3 replies · 3 participants
  • s

    Sudhir Singh Khanger

    11/19/2018, 8:53 AM
    What is Kotlin Migration?
    p
    g
    2 replies · 3 participants
  • l

    LG

    11/19/2018, 3:50 PM
    Hello 🙂 I’m a little bit stuck on a lambda, which I tried to use from itself
    val listener = {
                lottieAnimationView.viewTreeObserver.removeOnGlobalLayoutListener(listener)    <<<---- here's the problem
            }
            lottieAnimationView.viewTreeObserver.addOnGlobalLayoutListener(listener)
    Can anybody help on this please ?
    d
    b
    +1
    4 replies · 4 participants
  • j

    Jake

    11/19/2018, 4:37 PM
    Im using RxFlux in an application that was built originally with java. The
    MainActivity implements RxViewDispatch
    and catches store changes. On a store change I'm trying to update a single fragment that seemingly cannot listen to the store for changes. Is there a succinct way to broadcast from MainActivity.java to the single Fragment.java class to preform a visual update using the store changes?
    The interesting part of this is that most of the view that is rendered is controlled by this fragment, I don't want to redraw the entire fragment. NVM - forgot about `Intent`s - iOS Developer in an Android world.
    :stackoverflow: 2
    d
    1 reply · 2 participants
  • m

    MrNiamh

    11/19/2018, 8:56 PM
    New to android, what's the preferred way of tesing my UI and database correctly interact? I have tests for my Dao, and I have tests for my UI, but I'm unsure how to test that my UI correctly works with my Dao. E.g. clicking the save button correctly saves something to the database.
    :stackoverflow: 1
    j
    d
    5 replies · 3 participants
  • j

    jurajsolarml

    11/20/2018, 8:35 AM
    Hello,please help.I write mistakes. I'm writing a bug.No matching client found for package name 'com.example.jurajsolarml.simpleapp.dev'.How can I fix it? Thanks I try to run an application and list the error, specifically I want to run a firebase registration. google-services.json "package_name": "com.example.jurajsolarml.simpleapp" Firebase setup: Package name com.example.jurajsolarml.simpleapp
    j
    12 replies · 2 participants
  • s

    saurabha5

    11/20/2018, 1:02 PM
    I build a library using Kotkin 1.2 (experimental coroutines). Now a android app built on Kotlin 1.3 can consume the library? if there is no public api exposing coroutines, but internally using Kotkin 1.2 (experimental coroutines) in library
    s
    5 replies · 2 participants
  • s

    Steven McLaughlin

    11/20/2018, 2:59 PM
    Hey, this may be the wrong channel for this. If so, let me know and I'll delete this post. I've never built an android app (been mostly working server-side and front-end for the past few years), and I was wondering if maybe someone could point me towards a good resource for learning the ins-and-outs of building one. I'm very familiar with java and pretty familiar with kotlin as well. I'd prefer to start out with kotlin and make something small just to practice. I realize I can google this, but I thought maybe the people in here might have some more insight/better recommendations.
    j
    p
    2 replies · 3 participants
  • n

    neuber

    11/21/2018, 7:55 PM
    How to solve? pls
    :stackoverflow: 6
    d
    7 replies · 2 participants
  • m

    Mike Palarz

    11/21/2018, 10:58 PM
    Hey all! I have a coroutines question that I've been struggling with. I am making a network request in the following way:
    fun fetchCharacterData(): Deferred<CharacterGenerator.CharacterData> {
    return GlobalScope.async(Dispatchers.Default) {
    val apiData = URL(CHARACTER_DATA_ENDPOINT).readText()
    CharacterGenerator.fromApiData(apiData)
    }
    }
    Then, in my main activity, I do the following within `onCreate()`:
    generateButton.setOnClickListener {
    GlobalScope.launch(Dispatchers.Main){
    characterData = fetchCharacterData().await()
    displayCharacterData()
    }
    }
    However, I am getting an ANR whenever the button is pressed. I also get a very vague error message in logcat: FATAL EXCEPTION: main. Would anyone have any insight as to what the issue could be?
    c
    2 replies · 2 participants
  • s

    Sergio Crespo Toubes

    11/22/2018, 10:14 AM
    What libraries do you prefer for working with recycler views? and how you prefer to work with error, loading views?
    :stackoverflow: 3
    r
    2 replies · 2 participants
  • m

    Massimo Carli

    11/22/2018, 11:36 AM
    Hi All. I'm trying to use a high order function in order to check for permission in Android with this function:
    @ExperimentalContracts
    inline fun runIfGranted(context: Context, permission: String, fn: () -> Unit) {
        contract { returns(true) implies WHAT'S HERE? }  
        if (ContextCompat.checkSelfPermission(
                context,
                permission
            ) == PackageManager.PERMISSION_GRANTED
        ) {
            fn()
        }
    }
    . In order to remove the IntelliJ warning, I could use the
    @SuppressLint("MissingPermission")
    but I think that a contract would be the right solution. In that case, what should I put in the comment in the previous code in place of the literal
    true
    ?
    r
    2 replies · 2 participants
  • d

    dave08

    11/22/2018, 12:49 PM
    Why is it that SharedPreferences getXXX methods are all marked as returning null? Is there any way to avoid
    val foo: String = prefs.getString("foo", "") ?: ""
    ?
    t
    g
    37 replies · 3 participants
  • n

    Neal Sanche

    11/23/2018, 9:25 PM
    I've run into a strange one recently, and wonder if anyone else has any advice. A java.io.Serializable kotlin data class was written, and then later a 'by lazy' delegate property was added to that class. This showed up as an exception during serialization in two different ways: after Proguard was run, the delegate wasn't getting found, and before proguard an NPE was produced when accessing the delegated property after deserialization. I tried adding
    @delegate:Transient
    , but in the end, removed the 'by lazy' in favour of a Getter. Thanks for any advice or clarification.
    1 reply · 1 participant
  • k

    kim00123

    11/24/2018, 10:06 AM
    Kotlin-coroutines: Did you encounter this bug when enable R8 and proguard? https://github.com/Kotlin/kotlinx.coroutines/issues/858
    g
    1 reply · 2 participants
  • h

    Harun

    11/25/2018, 7:42 AM
    Lets say i want to update a user location every 30 seconds, currently i use a runnable with a handler to make this work. Is there a better way to do this is kotlin?
    :stackoverflow: 1
    d
    g
    4 replies · 3 participants
  • i

    igor.wojda

    11/26/2018, 9:15 AM
    ButterKnife provides button click debauncing under the hood, so user can’t quickly perform multiple button actions by clicking it multiple times. How to achieve this in kotlin + Kotlin Android Extension? Is there any to do it in easily in whole application?
    r
    3 replies · 2 participants
  • i

    igor.wojda

    11/26/2018, 12:27 PM
    thanks @rnpy for suggestion it look that someone already implemented
    DebouncedOnClickListener.java
    https://gist.github.com/rfreedman/5573388 - this should be a good start for me
    g
    r
    7 replies · 3 participants
  • j

    jurajsolarml

    11/26/2018, 3:27 PM
    Hello,please,I am a beginner.How do I fix it?,Kotlin,AS 3.2.1. Thank you https://hastebin.com/wolapozoli.cpp https://hastebin.com/zebujipequ.sql
    :stackoverflow: 1
    e
    9 replies · 2 participants
  • m

    Mike Palarz

    11/26/2018, 4:53 PM
    Hey guys! So I hope that this isn't an overly basic question here... I've seen some news about a Kotlin DSL for Gradle scripts. My question is, what does that mean for us Android devs? What can we do with a Kotlin DSL that we can't already do? I will admit that I'm not overly savvy with Gradle, but this did nonetheless pique my interest 🙂
    s
    d
    +1
    7 replies · 4 participants
  • d

    dan.the.man

    11/26/2018, 7:11 PM
    Does
    Any
    not work for any generic? I have code that's
    Expected : <http://Request.POST|Request.POST><Any, O>
    Actual: <http://Request.POST|Request.POST><I, O>
    and that's causing me some issues
    j
    i
    +2
    24 replies · 5 participants
  • d

    Danshima

    11/27/2018, 2:03 PM
    Does anyone know a good pdf renderer/viewer that works well with kotlin in android app? The native pdfrenderer renders complicated pdfs incorrectly
    ➕ 1
    g
    j
    2 replies · 3 participants
Powered by Linen
Title
d

Danshima

11/27/2018, 2:03 PM
Does anyone know a good pdf renderer/viewer that works well with kotlin in android app? The native pdfrenderer renders complicated pdfs incorrectly
➕ 1
g

gildor

11/27/2018, 4:48 PM
Any that works with Java, nothing Kotlin specific about PDF or PDF libraries
j

jcminarro

11/27/2018, 5:54 PM
you can try this one from @voghdev https://github.com/voghDev/PdfViewPager
View count: 6