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

    Lilly

    04/23/2020, 9:13 PM
    Thats what I have so far. Thanks in advance.
    g
    z
    3 replies · 3 participants
  • c

    Colton Idle

    04/24/2020, 6:51 AM
    Does anyone know if it's possible to get the image size from coil image loader? After loading my image I want to show a toast with the size in KB or MB.
    c
    6 replies · 2 participants
  • d

    diego-gomez-olvera

    04/24/2020, 11:03 AM
    I guess based on this https://github.com/JetBrains/kotlin-web-site/commit/30ce39a423f64dbd973b9f0768e2affbb56b5708#diff-d2793394d9d5216045358e64cf6b6dc7 that with View Binding being stable Kotlin Android Extensions for views are going away
    c
    2 replies · 2 participants
  • b

    Bala dakshna

    04/24/2020, 7:22 PM
    Friends, am new to programming and android looking for materials to understand Object Oriented Programming in kotlin. Any suggestion will greatly help. Thank you
    r
    2 replies · 2 participants
  • s

    Stefan Sturm

    04/25/2020, 12:22 PM
    For a new Android Project(I’m comming from iOS), what should I use? Jetpack Compose or Flutter?
    i
    m
    +1
    3 replies · 4 participants
  • d

    Dustin Lam

    04/25/2020, 8:50 PM
    What version of studio are you on? This is a known bug with how studio is resolving dependencies for lint, when there is a transitive dependency which offers a newer version of activity implementing that interface, see: https://issuetracker.google.com/issues/152245564 https://issuetracker.google.com/issues/146585040
    a
    1 reply · 2 participants
  • j

    Joan Colmenero

    04/26/2020, 10:23 AM
    Hello guys, I was just looking on this post [1] and I'm interested on this one, but I do not know what is
    FailureBo
    could someone give me an example of what should be? I do not know if it should extend of
    Failure
    or
    Throwable
    Thank you guys. [1] : https://proandroiddev.com/how-to-return-an-either-error-data-with-a-centralised-error-handler-on-android-72efdaf88cca
    i
    1 reply · 2 participants
  • s

    Smith

    04/26/2020, 7:05 PM
    PLEASE HELPP (StackOverflow does not have the answer) So i have a list(recycler view) of items which is loaded from a local db using room and pagination. Also i have used livedata for pagination. Now whenever i click an item, I want to highlight the text in it and save it to the database. But since this causes a change in the table, room triggers the livedata callback and the list is refreshed. So the problem is whenever i click “highlight text”, the list is refreshed and recycler view animation is fired leading to a bad ux. I want to avoid the room callback whenever i update the isHighlighted flag in the db. Also i want to keep using the pagination which uses live data observer, so i cannot remove the observer after the list is loaded.
    :stackoverflow: 5
    k
    t
    +1
    4 replies · 4 participants
  • l

    Lilly

    04/27/2020, 12:52 PM
    Hi, is
    Jetpack Compose
    aware of configuration changes or should we still use
    AAC ViewModel
    for this purpose?
    a
    5 replies · 2 participants
  • m

    Madhan

    04/27/2020, 2:54 PM
    Hi all, Today i tried to convert my build.gradle into build.gradle.kts. I followed kotlin DSL syntax, but my android { <-- shows error ... } --------------- this is my project level build file
    classpath("com.android.tools.build:gradle:3.6.3")
     classpath(kotlin("gradle-plugin", version = "1.3.72"))
    In my app module. android block not getting recognised. Can any one help me out this?
    v
    8 replies · 2 participants
  • p

    Pypdeveloper

    04/28/2020, 6:46 AM
    In my android app I want to run an class but in it won’t run at run time when I want open the app it won’t run. I have an app which has multiple screens and when I enter the profile page I wan’t to run that file.
    :thread-please: 1
    :google: 5
    a
    s
    20 replies · 3 participants
  • p

    Pypdeveloper

    04/28/2020, 11:46 AM
    In the same app I have an image view and it works perfectly fine on my android phone with the latest version of android but with and android phone running android 6 it crashes the app anyone know why?
    :thread-please: 1
    :stackoverflow: 3
    a
    4 replies · 2 participants
  • a

    Augusto Pinto

    04/28/2020, 6:17 PM
    Hi all, I'm thinking in develop a base project to use as a skeleton and reuse it in order to avoid a similar setup every time a new project is started from scratch. What setup do you think is important and should be in this base project?
    a
    f
    +1
    12 replies · 4 participants
  • j

    Joan Colmenero

    04/28/2020, 10:50 PM
    Hi, how do I test an extension function of a Toast or Progressbar?
    s
    n
    4 replies · 3 participants
  • p

    Pypdeveloper

    04/29/2020, 6:20 AM
    Can anyone please tell me a free api so that I can collect the covid-19 information and plot it in a map, there location.
    :thread-please: 1
    :google: 8
    i
    3 replies · 2 participants
  • i

    iex

    04/29/2020, 8:39 PM
    Hi! How to handle correctly errors when my Kotlin
    gson
    models declares a field as non-optional but the api doesn't send it? It doesn't crash when setting the field, but appears to force a
    null
    in somehow and it crashes later when accessing it.
    t
    5 replies · 2 participants
  • b

    bhatnagarm

    04/29/2020, 8:51 PM
    Hey everyone, as showcased in Google samples making Repository class as Singleton seems to be bit confusing. So as per my understanding a Singleton class doesn't get Garbage collected as it's instance being stored into static variable. Doesn't this seems kind of anti-pattern. Until it's some common repository what's the use case for it to outlive it's scope which may be just within a smaller scope. So what do you guys think?? How many of you consider making Repository class as Singleton. If yes, then I'm really Keen to understand.
    ➕ 3
    z
    2 replies · 2 participants
  • o

    Oleg Siboglov

    04/29/2020, 8:52 PM
    Hey everyone. Is there a simpler way to capture (Mockito) a single parameter of a Kotlin function that has multiple parameters, of which all have a default value.
    fun foo(int: Int = 0, string: String = "")
    verify(someMock).foo(int = intCaptor.capture)
    Currently Mockito is throwing a
    InvalidUseOfMatchersException
    , claiming its expecting 5 matchers (actual number of parameters) and instead it only recorded one. Im hoping theres a better approach than creating 5 different captors.
    b
    4 replies · 2 participants
  • n

    Nikola Milovic

    04/30/2020, 9:42 AM
    What are the best android libraries written in kotlin to clone, look at and learn from? Currently trying to my my own library but I am kinda stuck on finalizing it and improving it
    c
    1 reply · 2 participants
  • a

    aipok

    05/01/2020, 9:13 AM
    @Muhammad Zubair I’m wondering why we should not consider this channel in case someone have
    android
    related question. I was hopping we are community, even tho about
    kotlin
    mainly, that are filled with professionals in Android and near technologies. And if we are professionals, why could we ask here tricky
    android
    questions to get smart answers and getting even smarter?! Even if question is not fully related to
    kotlin
    !
    w
    z
    3 replies · 3 participants
  • s

    Shahumang8

    05/02/2020, 9:39 AM
    Hi All, I am trying to implement dropdown with custom layout like below image but i can't able to set selected value on AutoCompleteTextView because AutoCompleteTextView have only 1 method setText but i am displaying custom list so i can't able to set value like listview so could you please provide me your view how i can change AutoCompleteTextView design
    :stackoverflow: 4
    r
    3 replies · 2 participants
  • a

    Ahmed Mourad

    05/02/2020, 12:06 PM
    I've just published Bundlizer, Android Bundle format support for Kotlinx Serialization. Feedback is very welcome! https://github.com/AhmedMourad0/bundlizer
    👍 1
    p
    10 replies · 2 participants
  • n

    Nav Singh

    05/02/2020, 4:45 PM
    Article about how kotlin makes development smooth and clean https://medium.com/@navjot.singh637/kotlin-makes-android-development-smoother-than-ever-c1e6b12cd992
    p
    s
    5 replies · 3 participants
  • r

    rkeazor

    05/02/2020, 6:15 PM
    anyone running into issues with Artifactory and AS 4.1
    z
    5 replies · 2 participants
  • a

    Ahmed Adel

    05/03/2020, 5:34 PM
    👋 I was working for a while on a use case for creating a gradient polyline on Google Maps in Android natively since it is not a built-in API in Google Maps Android SDK. So, I created a Github Repository that discussing the use case, the approach that I took, and how I implement it to show a gradient polyline on Google Maps in Android. If you are interested in such a topic, please take a look and feel free to reach out or to contribute 🙂 https://github.com/ahmedadeltito/GradientPolyline
    k
    a
    3 replies · 3 participants
  • d

    Darshan

    05/03/2020, 6:13 PM
    Guys is there any Android java community? Can anyone share the details... Because I'm very to new Kotlin... Even we can implement Kotlin along with java.. I'm finding difficult to find solutions.. So Android java would really help
    z
    1 reply · 2 participants
  • g

    Geert

    05/04/2020, 11:22 AM
    Is there something similar to Swift Keypaths in Android?
    🇳🇴 1
    g
    1 reply · 2 participants
  • k

    Klaas Kabini

    05/04/2020, 11:34 AM
    Can you do this in android? I want to make sure that the function accepts an IntArray of StringRes ids.
    fun foo(@StringRes clickablePhraseIds: IntArray){}
    d
    2 replies · 2 participants
  • s

    Shawn Karber_

    05/04/2020, 10:47 PM
    I've been trying to implement an Android BLE Scanner in java with no success, at all. Has anyone had any success with any kotlin libraries or kotlin itself in implementing a BLE scanner? Is it easier than in Android, or just as bad?
    m
    r
    2 replies · 3 participants
  • a

    Aslam Hossin

    05/05/2020, 4:50 AM
    Listener registration not working in fragment to Dialog fragment communication. Am I missing anything for registration ?
    override fun onAttach(context: Context) {
        AndroidSupportInjection.inject(this)
        super.onAttach(context)
        if (context is Listener) {
          listener = context
        }
      }
    
      override fun onDetach() {
        super.onDetach()
        listener = null
      }
    d
    5 replies · 2 participants
Powered by Linen
Title
a

Aslam Hossin

05/05/2020, 4:50 AM
Listener registration not working in fragment to Dialog fragment communication. Am I missing anything for registration ?
override fun onAttach(context: Context) {
    AndroidSupportInjection.inject(this)
    super.onAttach(context)
    if (context is Listener) {
      listener = context
    }
  }

  override fun onDetach() {
    super.onDetach()
    listener = null
  }
d

David Eriksson

05/05/2020, 7:50 AM
I don't think that's how you pass a listener to a fragment...
https://developer.android.com/training/basics/fragments/communicating
👍 1
a

Aslam Hossin

05/05/2020, 11:20 AM
I've been solved this issue in this way
override fun onCreate(savedInstanceState: Bundle?) {
  super.onCreate(savedInstanceState)
  listener=
    parentFragment?.childFragmentManager?.primaryNavigationFragment.cast<Listner>()
}

override fun onDestroy() {
  super.onDestroy()
  listener= null
}
d

David Eriksson

05/05/2020, 12:00 PM
That's not how Google recommends either, but it's your app :)
a

Aslam Hossin

05/05/2020, 12:05 PM
Basically I have been tried different ways even you suggested one but no luck. Only the above solutions working perfectly. Thanks for your input. Fragment to DialogFragemnt target set not register at all and that's why I have been implemented this solution.
View count: 2