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

    Ahmed Adel

    09/30/2018, 9:53 PM
    Hello People 🖐️🏻 Need help, anyone here works on new Android Slices, I want to ask about something
    h
    • 2
    • 1
  • s

    shrawan

    10/01/2018, 3:04 PM
    Is there any similar blog/concept on Android as- https://medium.com/@stasost/ios-root-controller-navigation-3625eedbbff
    m
    • 2
    • 1
  • c

    Carlos Ottoboni

    10/01/2018, 8:16 PM
    Hello Guys, I'm using Android Architecture Components Room in my project and I have an
    Entity
    with a
    Enum
    class as a property. It's something like this:
    @Entity(tableName = "tb_episode")
    data class Episode (
    
        var title: String,
        
        var episodeType: EpisodeType
        ...
    )
    And I have the
    TypeConverter
    for it:
    object Converters {
    
        @TypeConverter
        @JvmStatic
        fun toEnum(code: Int): EpisodeType {
            return when (code) {
                1 -> EpisodeType.PODCAST
                2 -> EpisodeType.ALBUM_REVIEW
                else -> EpisodeType.DEFAULT
            }
        }
    
        @TypeConverter
        @JvmStatic
        fun fromEnum(type: EpisodeType): Int {
            return when (type) {
                EpisodeType.PODCAST -> 1
                EpisodeType.ALBUM_REVIEW -> 2
                else -> 0
            }
        }
    }
    Also, I added the
    TypeConverters
    Annotation to my Database class:
    @TypeConverters(Converters::class)
    abstract class AppDatabase : RoomDatabase()
    But when I try to run the App I get this message:
    Class is referenced as a converter but it does not have any converter methods.
    I don't know if Room doesn't support Kotlin
    Enum
    class or if I'm doing something wrong. Anyone can help me with this?
    m
    • 2
    • 4
  • a

    AzMoo

    10/02/2018, 12:19 AM
    I’ve noticed that FragmentActivity.activity can be null, in what situation could this occur? Can the activity be destroyed without the destruction of the fragment?
    a
    g
    s
    • 4
    • 3
  • n

    neuber

    10/02/2018, 3:41 AM
    Can anyone help me:
    g
    • 2
    • 8
  • s

    Slackbot

    10/02/2018, 3:41 AM
    This message was deleted.
    r
    n
    • 3
    • 3
  • d

    Dedy Kurniawan

    10/02/2018, 4:40 AM
    What's name of this? Why I couldn't put Toast in it?
    r
    • 2
    • 3
  • c

    CamilleBC

    10/02/2018, 8:50 AM
    @gildor Thanks for the link ! My problem is that I don't really understand coroutines, I guess! 😄 I was setting up a simple app to update some values by making API calls in HTTP. I managed to communicate through the socket using coroutines, but as soon as I was trying to update the UI through callbacks, it became messy. That's why I thought of just creating one other thread for the network and not use coroutines. But I felt I was just going at it the wrong way, so that UI looks perfect to me! Thanks again 😉
    g
    e
    • 3
    • 11
  • c

    CamilleBC

    10/02/2018, 1:06 PM
    My team doesn't want dependencies. 😞 Would using OkHttp (which HttpUrlConnection implements anyway) change anything? Because I might be able to sell that.
    😱 2
    r
    • 2
    • 1
  • s

    Sam

    10/02/2018, 3:02 PM
    Fwiw, Android internally uses okhttp. https://android.googlesource.com/platform/external/okhttp/
    d
    • 2
    • 2
  • m

    matt tighe

    10/03/2018, 4:51 PM
    if i were to add DI to an already established project, is it worth considering Koin at this point, or is Dagger 2 still the suggested route?
    a
    d
    +4
    • 7
    • 8
  • n

    neuber

    10/03/2018, 7:22 PM
    https://github.com/Nilhcem/i2cfun-androidthings/blob/master/app/src/main/java/com/nilhcem/androidthings/i2cfun/device/components/ArduinoFanI2C.kt Hi, What modifications would I have to make in the code above, to make the result of this line: companion object { fun fromValue (i2cValue: Int) = Speed.values (). firstOrNull {it.i2cValue == i2cValue}?: MEDIUM which in the case is static (MEDIUM) in dynamic, ie, I want to get this value from a firebase field
    :stackoverflow: 1
    d
    r
    +3
    • 6
    • 13
  • s

    Sam

    10/04/2018, 9:14 PM
    Why does studio autofill generates a nullable bundle for onRestoreInstanceState?
    override fun onRestoreInstanceState(savedInstanceState: Bundle?) {
            super.onRestoreInstanceState(savedInstanceState)
        }
    t
    l
    • 3
    • 10
  • j

    Jason

    10/05/2018, 9:03 AM
    I am reading some code from developer in github. setOnKeyListener(View.OnKeyListener { v, keyCode, event -> if ((event?.action == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { action(text.toString()) return@OnKeyListener true I dont know the purpose of line : return@OnKeyListener true
    e
    • 2
    • 3
  • p

    Pratham

    10/06/2018, 4:42 AM
    Does anyone knows what would be returned in case there is no data in database
    r
    • 2
    • 1
  • e

    Eugen Martynov

    10/07/2018, 11:00 AM
    Hi guys, anyone has problem with Dagger component builder @BindInstance and kotlin inline classes
    t
    • 2
    • 1
  • t

    tyler

    10/07/2018, 11:20 PM
    I will pay $ to anyone who can help solve my issue tonight 😉
    o
    • 2
    • 2
  • m

    Markchous

    10/08/2018, 2:56 PM
    Running into an interesting issue with a
    BroadcastReceiver
    when trying to set a permission. So I set the permission in the sending app in the manifest using
    <uses-permission.... />
    and then include that permission in the
    sendBroadcast(intent, permission)
    call. And in the receiving app I have the permission set in the manifest where I am declaring the receiver. But my
    BroadcastReceiver
    won't accept the broadcast. The interesting thing is that as soon as I remove the permission from both apps, my broadcast works perfectly. Any ideas? Edit: Fixed. It was due to the app signature.
    s
    • 2
    • 3
  • o

    oday

    10/09/2018, 7:55 AM
    any idea why my proguard is failing here? https://pastebin.com/itxRfUKx here’s my .pro file https://pastebin.com/56EDACgH
    r
    • 2
    • 19
  • p

    paulex

    10/09/2018, 12:08 PM
    Please, How do i force a function to use its default... priorityFilter is null i want it to use the default value
    -.kt
    e
    a
    r
    • 4
    • 3
  • a

    adev_one

    10/09/2018, 3:10 PM
    I want to implement reactive UI framework based on Anko with syntax like this. But I get error
    Unsupported reference to synthetic extension property for a Java get/set method
    . Is there way to fix it without creating extension property for each get/set? Or may be any ideas about another clear syntax to bind view property with reactive property?
    e
    r
    • 3
    • 13
  • j

    jurajsolarml

    10/09/2018, 4:09 PM
    Hello, you need to run the ContactsDetail NavigationDrawer activity from the MenuMain NavigationDrawer.I write a bug. How to fix it? Thank you https://hastebin.com/xanowezila.cpp
    :stackoverflow: 5
    r
    • 2
    • 7
  • j

    jaydeepc52

    10/10/2018, 9:33 AM
    Hi All, i am converting kotlin code to java and stuck on some function can someone please help me on below code https://paste.ofcode.org/3asiRwyrz4343W3UE8jZm2Z Main: line 21 to 29 thanks in advance
    🤔 1
    g
    r
    • 3
    • 7
  • r

    rkeazor

    10/10/2018, 12:18 PM
    -.java
    j
    • 2
    • 1
  • l

    lawlorslaw

    10/10/2018, 11:52 PM
    how do you do a check for a
    lateinit var
    to know when its been initialized
    i
    • 2
    • 1
  • l

    lawlorslaw

    10/11/2018, 6:27 AM
    im asking because i have seen some crashes with it, and i dont think its being maintained anymore
    e
    • 2
    • 1
  • l

    luke_c

    10/11/2018, 12:19 PM
    Is the application context only garbage collected when the application is destroyed, or is there any other scenarios where it might happen? Trying to understand why when creating singletons / kotlin objects it seems normal to pass in the context every time. Could you not just initialise it with the context one then call getInstance() or whatever without having to pass in the context? The object would be initialised in the Application class of course
    e
    s
    • 3
    • 2
  • l

    luke_c

    10/11/2018, 12:21 PM
    e.g. Google pass in the context to every getInstance() call here https://github.com/googlesamples/android-architecture-components/blob/master/BasicRxJavaSampleKotlin/app/src/main/java/com/example/android/observability/persistence/UsersDatabase.kt
    :stackoverflow: 1
    🤮 5
    m
    l
    • 3
    • 6
  • a

    anpham6

    10/11/2018, 5:15 PM
    New version 2.0. https://github.com/anpham6/androme
    ❓ 3
    :kotlin: 1
    👎 2
    r
    • 2
    • 1
  • l

    locke

    10/11/2018, 7:39 PM
    Anyone know what causes the
    DataBinding
    library to not recognize
    DataBindingComponent
    ? StackOverflow is referencing the transition from AS 3.0 to 3.1, but I'm using 3.2 and am not really sure what's going on. Build tools version 3.2.0 if it's relevant.
    c
    g
    t
    • 4
    • 5
Powered by Linen
Title
l

locke

10/11/2018, 7:39 PM
Anyone know what causes the
DataBinding
library to not recognize
DataBindingComponent
? StackOverflow is referencing the transition from AS 3.0 to 3.1, but I'm using 3.2 and am not really sure what's going on. Build tools version 3.2.0 if it's relevant.
c

Casey Brooks

10/11/2018, 7:47 PM
Is it the build itself crashing, or just AS showing the class as red?
l

locke

10/11/2018, 7:49 PM
The build itself is crashing
protected ActivityMaintenanceBinding(DataBindingComponent _bindingComponent, View _root,
                                       ^
  symbol:   class DataBindingComponent
  location: class ActivityMaintenanceBinding
g

gildor

10/12/2018, 12:42 AM
You have annotation processing error somewhere, check your build logs
t

tapchicoma

10/12/2018, 6:26 AM
check AS 3.2.1 release notes: https://developer.android.com/studio/releases/
The following bugs have been fixed:
When using the Data Binding library, variable names with underscores were causing compilation errors.
Possibly it is your case.
View count: 1