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

    hfhbd

    08/03/2021, 12:52 PM
    Anybody succeeded with Room and multi modules?
    // shared module, not depending on android
    interface Dao {
      suspend fun getAll(): List<A>
    }
    
    // android
    @Dao
    interface RoomDao {
        @Query("select * from a")
        override suspend fun getAll(): List<A>
    }
    I am always getting
    An abstract DAO method must be annotated with one and only one of the following annotations: Insert,Delete,Query,Update,RawQuery - Dao.getAll()
    Do I really have to annotate the
    Dao.getAll
    too, even if I override this function in RoomDao with the one annotation? https://medium.com/androiddevelopers/7-pro-tips-for-room-fbadea4bfbd1#dd40
    • 1
    • 1
  • p

    pollux-

    08/04/2021, 4:00 AM
    How to get the status of bluetooth on/off using broadcast receiver defined in Manifest
    <receiver
        android:name="org.kp.m.arrivalnotification.usecase.BluetoothStatusReceiver"
        >
        <intent-filter>
            <action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
        </intent-filter>
    </receiver>
    this doesn’t help. I was thinking, this is exempted list of receivers 🤔 Appreciate the help in advance 😇
    :not-kotlin: 6
    c
    • 2
    • 2
  • k

    KL3B3R

    08/04/2021, 4:05 AM
    Hi guys. I need learn Kotlin. Were start the language (a course especific). Help... please, friends...🙂
    c
    s
    • 3
    • 2
  • a

    Anshulupadhyay03

    08/04/2021, 7:22 AM
    enum class Type(val value: String, val colorCode: String) {
    
        BUY("B", GREEN),
        SELL("S", RED),
        UNKNOWN("", "");
    
        private companion object {
             private const val GREEN = "#3fc963"
            private const val RED = "#e35353"
        }
    }
    it is showing compile error on GREEN and RED as it should be initialized. i have init in the companion obj why is the error then?
    c
    l
    +2
    • 5
    • 14
  • s

    Shalu TD

    08/04/2021, 12:51 PM
    Hi gusys. I have a question related to coroutine. Coroutine block can update the UI after activity finished? If tries to update, crash happens?
    c
    d
    +2
    • 5
    • 15
  • s

    Slackbot

    08/04/2021, 7:59 PM
    This message was deleted.
    c
    s
    n
    • 4
    • 4
  • h

    haris mehmood

    08/05/2021, 9:29 AM
    {
        
    "responseCode": 200,
        
    "message": "Success",
        
    "response": {
            
    "Items": [
                
    {
                    
    "purpose": "Instant Checkup",
                    
    "date": "16 Jul 2021",
                    
    "created_at": "Fri, 16 Jul 2021 09:54:10 +0000",
                    
    "uuid": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f3",
                    
    "amount": 1500,
                    
    "Version": "2012-10-17",
                    
    "Id": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f6"
                
    },
                
    {
                    
    "purpose": "Instant Checkup",
                    
    "date": "16 Jul 2021",
                    
    "created_at": "Fri, 16 Jul 2021 09:54:10 +0000",
                    
    "uuid": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f3",
                    
    "amount": 1500,
                    
    "Version": "2012-10-17",
                    
    "Id": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f9"
                
    },
                
    {
                    
    "purpose": "Instant Checkup",
                    
    "date": "16 Jul 2021",
                    
    "created_at": "Fri, 16 Jul 2021 09:54:10 +0000",
                    
    "uuid": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f3",
                    
    "amount": 1500,
                    
    "Version": "2012-10-17",
                    
    "Id": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f1"
                
    },
                
    {
                    
    "purpose": "Instant Checkup",
                    
    "date": "16 Jul 2021",
                    
    "created_at": "Fri, 16 Jul 2021 09:54:10 +0000",
                    
    "uuid": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f3",
                    
    "amount": 1500,
                    
    "Version": "2012-10-17",
                    
    "Id": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f7"
                
    },
                
    {
                    
    "purpose": "Instant Checkup",
                    
    "date": "16 Jul 2021",
                    
    "created_at": "Fri, 16 Jul 2021 09:54:10 +0000",
                    
    "uuid": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f3",
                    
    "amount": 1500,
                    
    "Version": "2012-10-17",
                    
    "Id": "4aa792da-2ef8-4253-8c7c-3e3f6b9f1511"
                
    },
                
    {
                    
    "purpose": "Instant Checkup",
                    
    "date": "16 Jul 2021",
                    
    "created_at": "Fri, 16 Jul 2021 09:54:10 +0000",
                    
    "uuid": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f3",
                    
    "amount": 1500,
                    
    "Version": "2012-10-17",
                    
    "Id": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f3"
                
    },
                
    {
                    
    "purpose": "Instant Checkup",
                    
    "date": "16 Jul 2021",
                    
    "created_at": "Fri, 16 Jul 2021 09:54:10 +0000",
                    
    "uuid": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f3",
                    
    "amount": 1500,
                    
    "Version": "2012-10-17",
                    
    "Id": "4aa792da-2ef8-4253-8c7c-3e3f6b9f1510"
                
    },
                
    {
                    
    "purpose": "Promotion",
                    
    "date": "16 Jul 2021",
                    
    "created_at": "Fri, 16 Jul 2021 09:54:10 +0000",
                    
    "uuid": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f3",
                    
    "Version": "2012-10-17",
                    
    "amount": 500,
                    
    "Id": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f5"
                
    },
                
    {
                    
    "purpose": "Instant Checkup",
                    
    "date": "16 Jul 2021",
                    
    "created_at": "Fri, 16 Jul 2021 09:54:10 +0000",
                    
    "uuid": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f3",
                    
    "amount": 1500,
                    
    "Version": "2012-10-17",
                    
    "Id": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f2"
                
    },
                
    {
                    
    "purpose": "Appointment fee",
                    
    "date": "16 Jul 2021",
                    
    "created_at": "Fri, 16 Jul 2021 09:54:10 +0000",
                    
    "uuid": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f3",
                    
    "Version": "2012-10-17",
                    
    "amount": 1000,
                    
    "Id": "4aa792da-2ef8-4253-8c7c-3e3f6b9f15f4"
                
    }
            
    ],
            
    "Count": 10,
            
    "ScannedCount": 10,
            
    "LastEvaluatedKey": "eyJJZCI6ICI0YWE3OTJkYS0yZWY4LTQyNTMtOGM3Yy0zZTNmNmI5ZjE1ZjQiLCAidXVpZCI6ICI0YWE3OTJkYS0yZWY4LTQyNTMtOGM3Yy0zZTNmNmI5ZjE1ZjMifQ=="
        
    }
    }
    Can we use this kind of response For paging library 3 ?
    👎 4
    :goberserk: 2
    🧵 3
    :not-kotlin: 12
    n
    • 2
    • 1
  • v

    Vivek Modi

    08/05/2021, 2:18 PM
    Hey anyone know how to disable 3rd party keyboard in our app. Thanks in advance
    :not-kotlin: 9
    s
    z
    • 3
    • 2
  • b

    Ben Dodson

    08/05/2021, 4:19 PM
    Hi, we’re working on our upgrade from Kotlin 1.4.32 to 1.5.21. We’re seeing a large regression in both app size and startup performance, which seems to be due to R8 now poorly handling lambda classes (eg, merging seems to not be working). Anyone else face this or have ideas how to resolve?
    e
    • 2
    • 3
  • s

    Slackbot

    08/06/2021, 3:37 AM
    This message was deleted.
    :not-kotlin: 10
    g
    n
    m
    • 4
    • 4
  • m

    magnumrocha

    08/06/2021, 11:23 AM
    hi guys, is this the right way to use
    @Parcelize
    on kotlin sealed classes:
    sealed class MySealedClass : Parcelable {
        @Parcelize object Object1: MySealedClass()
        @Parcelize object Object2: MySealedClass()
        @Parcelize object Object3: MySealedClass()
    }
    I am getting the error:
    android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.myapp.data.MySealedClass$Object1
    when try to create the Intent….
    a
    c
    k
    • 4
    • 9
  • j

    Jason Inbody

    08/06/2021, 4:42 PM
    I'm trying to use fuel http request library and just found out it does't support PATCH requests.... It's supposed to send an X-HTTP-Method-Override inside the header to my server (django) but my servers never getting it...
    :not-kotlin: 3
    • 1
    • 3
  • p

    Pardeep Sharma

    08/07/2021, 3:15 AM
    Hi guys, I did set up Hilt dependency following this. I am using @HiltAndroidApp on BaseApplication class and @AndroidEntryPoint on MainActivity. But I am getting this error:
    java.lang.RuntimeException: Unable to instantiate application com.sample.gitapp.BaseApplication: java.lang.ClassNotFoundException: Didn't find class "com.sample.gitapp.BaseApplication" on path: DexPathList[[zip file "/data/app/com.sample.gitapp-2/base.apk"],nativeLibraryDirectories=[/data/app/com.sample.gitapp-2/lib/arm64, /system/lib64, /vendor/lib64, /system/vendor/lib64]]
    Any idea on it?
    c
    • 2
    • 3
  • t

    Tuan Kiet

    08/07/2021, 11:46 AM
    I'm intended to write a tutorial series about dagger basic, anyone interested in it?
    👍🏽 1
    👍 10
    v
    n
    +2
    • 5
    • 5
  • d

    dave08

    08/08/2021, 11:08 AM
    Hi! Is it still better to use Android Studio over Intellij Ultimate for android projects?
    👍 1
    z
    d
    +3
    • 6
    • 12
  • v

    Vibhav Airan

    08/08/2021, 1:38 PM
    Hey Guys! Just wanted to ask that Is there any better way to refresh the item views of a recycler view without actually notifying the adapter to refresh the whole thing?
    :not-kotlin: 3
    j
    • 2
    • 3
  • g

    gregory phiri

    08/08/2021, 6:20 PM
    Good day guy, I am new to android programming. May you please share with me any jetpack-compose library for a donut chart.
    :not-kotlin: 3
    o
    z
    • 3
    • 4
  • s

    Sudhir Singh Khanger

    08/09/2021, 2:28 AM
    :not-kotlin: is excessive IMHO. Curious if the community feels strongly in favour of not allowing #android discussion which isn't related to the #kotlin language?
    💯 1
    ✔️ 1
    👍 2
    :also-yes: 2
    :yes-black: 2
    :not-kotlin: 7
    :yes: 2
    k
    d
    +5
    • 8
    • 25
  • k

    Kshitij Patil

    08/09/2021, 5:18 AM
    Are there any performance benchmarks for
    Flow
    support in Room ? How many updates it could consistently reflect? I have a fragment with recyclerview listening for realtime DB changes using
    Flow<List<T>>
    for a
    select *
    query and am performing ~10 writes/sec with
    REPLACE
    strategy, in the background. This results in dropping out some records (if there are 2 records in the list being updated frequently, they get merged into one, while having different values for primary key) I'm not sure what exactly is a bottleneck here because SQLITE can easily handle these many writes.
    j
    • 2
    • 1
  • a

    Alexander

    08/09/2021, 6:02 AM
    Hello everyone, I'm looking for a good example of combining compose and an existing app, maybe someone has a link?
    a
    • 2
    • 1
  • f

    Florian

    08/09/2021, 9:32 AM
    Using the Jetpack Navigation library, how do you handle an optional Long id that you send to an add/edit screen? Longs can't be nullable in the Navigation library so do I set the default value to -1 instead?
    :not-kotlin: 1
    f
    • 2
    • 2
  • a

    Anyelo Vinzen

    08/10/2021, 1:33 AM
    I have a problem for load data in server using retrofit some idea for what's a problem? i'm using my own server this in azure.
    i
    c
    e
    • 4
    • 12
  • j

    Jason Inbody

    08/10/2021, 1:46 AM
    How do I bing a service with kotlin
    bindService
    doesn't work. Whats the kotlin equivalent?
    private fun initiateNokeService() {
        val nokeServiceIntent = Intent(this.user.context, NokeDeviceManagerService::class.java)
        bindService(nokeServiceIntent, mServiceConnection, Context.BIND_AUTO_CREATE)
    }
    thats the function I'm trying to implement but can't seem to figure out how to bind the service
    • 1
    • 1
  • s

    Slackbot

    08/10/2021, 12:32 PM
    This message was deleted.
    :not-kotlin: 5
    h
    • 2
    • 1
  • s

    Slackbot

    08/10/2021, 9:55 PM
    This message was deleted.
    :not-kotlin: 5
    e
    • 2
    • 2
  • h

    Hovhannes

    08/11/2021, 11:42 AM
    Hello, is it ok to use a ViewModel for different fragments/activities?
    :not-kotlin: 6
    u
    a
    • 3
    • 3
  • v

    Vibhav Airan

    08/11/2021, 12:48 PM
    Hello. Is there any way to send data to previous activity other than using startActivityForResult or storing it in preferences?
    :not-kotlin: 3
    n
    a
    • 3
    • 12
  • m

    Mark

    08/11/2021, 1:47 PM
    message has been deleted
    k
    • 2
    • 7
  • h

    Hovhannes

    08/11/2021, 1:52 PM
    Hello, how can we pass url to Web Service file using repository and ViewModel?
    :not-kotlin: 5
    c
    • 2
    • 1
  • t

    The Monster

    08/12/2021, 1:15 AM
    How is this View inflated? Is TextView a field of LinearLayout or gets moved somewhere?
    xml
    <LinearLayout xmlns:android="<http://schemas.android.com/apk/res/android>"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
    
        <TextView
            android:id="@+id/item_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    
    </LinearLayout>
    :google: 1
    :stackoverflow: 1
    :not-kotlin: 4
    l
    k
    h
    • 4
    • 6
Powered by Linen
Title
t

The Monster

08/12/2021, 1:15 AM
How is this View inflated? Is TextView a field of LinearLayout or gets moved somewhere?
xml
<LinearLayout xmlns:android="<http://schemas.android.com/apk/res/android>"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView
        android:id="@+id/item_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</LinearLayout>
:google: 1
:stackoverflow: 1
:not-kotlin: 4
l

Luis

08/12/2021, 2:17 AM
Not sure what else you are asking, but the text view becomes a child of the linear layout during inflation. Usually you would access views via
findViewById()
in your activity or fragment.
t

The Monster

08/12/2021, 3:12 AM
I meant like, after the TextView is inflated(turned into Java objects), does it get added as a property of the LinearLayout object or not? Maybe added into a data structure inside LinearLayout?
k

Kirill Grouchnikov

08/12/2021, 4:18 AM
If you're interested in how this works under the hood, you'd look at the source code of LayoutInflater (around lines 627-690) and ViewGroup (around lines 5338-5366). The :not-kotlin: tag means that this, though, has nothing to do with the purpose of this channel, and questions like this do not get much traction 99% of the time.
l

Luis

08/12/2021, 5:55 AM
Yep, you can use cs.android.com to search for sources. The TextView ends up added to an array of views inside the LinearLayout, check the source!
👍 1
t

The Monster

08/12/2021, 1:51 PM
I found it in ViewGroup source code at the location specified. It's my first time asking question here, so I guess I used the channel incorrectly. Still, thanks for the help.
h

Haomin

08/13/2021, 9:18 PM
@Luis Thats a great website, I never there is a site like this
👍 1
View count: 3