https://kotlinlang.org logo
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
  • z

    Zaraki596

    07/12/2018, 12:49 PM
    Does anybody know a good resource to learn Fragments through Kotlin?
    r
    a
    r
    • 4
    • 7
  • r

    rakshith059

    07/12/2018, 3:40 PM
    Hi I am creating a android TV app with streaming videos, I can stream videos which is hosted in firebase storage or in local server but not able to play youtube videos using player.. Can anyone please guide me?
    :stackoverflow: 2
    h
    • 2
    • 2
  • h

    Hammad

    07/12/2018, 3:48 PM
    [SOLVED] Copying my sqlite db file from assets to database path ends up blank with only a single table android_metadata. What am I doing wrong here?
    private fun copyDatabase() {
            ctx.assets.open(DB_NAME).buffered().use { input ->
                ctx.getDatabasePath(DB_NAME).outputStream().buffered().use { output ->
                    input.copyTo(output, 1024)
                }
            }
        }
    a
    • 2
    • 3
  • m

    muralimohan962

    07/13/2018, 10:19 AM
    Hello! How do i update UI from my worker class implementation when using workmanager for background tasks?
    :stackoverflow: 4
    d
    • 2
    • 2
  • m

    Mark Buikema

    07/13/2018, 2:47 PM
    Hi guys! I am using architecture components with `ViewModel`s. What's best practice to ensure my activities and fragments can not access
    MutableLiveData
    from my
    ViewModel
    , only
    LiveData
    , in order to prevent the activities and fragments from changing values of the `LiveData`s?
    r
    a
    • 3
    • 5
  • n

    neuber

    07/14/2018, 3:21 AM
    I have issue when transpose this code from java to kotlin
    d
    • 2
    • 1
  • a

    Allan Wang

    07/14/2018, 5:07 AM
    And lastly, there is a keyboard shortcut to convert java into compilable kotlin code. ctrl + alt + shift + k
    n
    • 2
    • 5
  • h

    Hele

    07/14/2018, 10:12 AM
    but I can't get the info to booklist like it happens in this video

    https://youtu.be/53BsyxwSBJk?t=1062▾

    👎 1
    r
    • 2
    • 1
  • h

    Hele

    07/14/2018, 10:30 AM
    oh I fixed the issue, it seems I would have to write class and variable names exactly same with my json data
    r
    • 2
    • 1
  • a

    Abbas

    07/14/2018, 6:17 PM
    Hello friends, what is the most effective way to upload files to the server? Convert to byte? Or uploaded directly? Or ... ?
    :stackoverflow: 5
    h
    • 2
    • 6
  • s

    sudhanshu singh

    07/15/2018, 12:48 PM
    I have a data class
    data class Response(
    @SerializedName("someVariable") var type: Long?=null)
    I can get null value from the server, but in my code I am only bothered with non null value of someVariable. Would it be right approach to write someVariable as nonNullable Response class as
    data class Response(
    @SerializedName("someVariable") var type: Long=0)
    r
    • 2
    • 1
  • a

    Ayden

    07/15/2018, 2:17 PM
    The library accept
    Boolean
    but I am using
    Boolean?
    m
    r
    • 3
    • 29
  • g

    gaspard

    07/15/2018, 5:29 PM
    What do you use for Dependency Injection? Dagger? Koin?
    r
    m
    l
    • 4
    • 3
  • p

    paulex

    07/16/2018, 4:05 PM
    Afternoon, please:: can i ask an android xml related question here... that has to do with slow view rendering..
    👎 1
    :stackoverflow: 4
    k
    • 2
    • 3
  • a

    arekolek

    07/17/2018, 11:31 AM
    I don't do it to "avoid that its type can be null", I do it to handle the fact those properties are non-null but can't be initialized until
    onCreate
    is called, in that case I think
    lateinit
    is a godsend
    a
    t
    • 3
    • 31
  • s

    Slackbot

    07/17/2018, 11:32 AM
    This message was deleted.
    d
    a
    • 3
    • 4
  • g

    gokul

    07/18/2018, 6:19 AM
    var productList = MutableLiveData<ArrayList<Fnblist>>() fun add(subitem: Subitem, position: Int) { productList.value?.get(position)?.subitems?.get(0)?.count = 2 } not observing on property change.. need help
    :stackoverflow: 1
    ❓ 1
    e
    m
    • 3
    • 5
  • a

    Alin B.

    07/18/2018, 10:25 AM
    After playing
    with
    kotlin, coming from java in android studio and coding for a few days, I can say that kotlin is
    fun
    😂 7
    a
    c
    m
    • 4
    • 4
  • f

    fradiati

    07/18/2018, 12:22 PM
    but if i get null from json how can i handle this situation?
    j
    • 2
    • 2
  • a

    Ayden

    07/18/2018, 3:19 PM
    I need to install these package?
    a
    • 2
    • 1
  • a

    adalbert

    07/18/2018, 7:33 PM
    hi! I encounter problem with vector drawable. I got asset - vector drawable with radius corners. I need to add shadow to this vector drawable, what is the best way? CardView, 9 patch?
    :stackoverflow: 3
    l
    d
    • 3
    • 2
  • b

    bbade_

    07/19/2018, 11:51 PM
    Is there anything that would cause synthetic layout properties to not be generated for a single layout file? I just created an activity and the synthetics weren't generated for it. But findviewbyid works, so it's being parsed correctly. And building and running works too. Also, is there any way to debug why this would be happening?
    f
    • 2
    • 1
  • t

    tigran.babajanyan

    07/20/2018, 8:55 AM
    Hey, how can I make a simple chart like this one?
    :stackoverflow: 6
    l
    • 2
    • 4
  • a

    Ayden

    07/20/2018, 9:22 AM
    {
      "result": [
        {
          "id": 1,
          "user_id": 1,
          "url": "<https://www.brainyquote.com/photos_tr/en/h/hjacksonbrownjr/382774/hjacksonbrownjr1.jpg>",
          "author": "H. Jackson Brown, Jr.",
          "created_at": "2018-06-18 08:44:57",
          "updated_at": "2018-06-18 08:44:57"
        },
        {
          "id": 2,
          "user_id": 1,
          "url": "<https://www.brainyquote.com/photos_tr/en/h/hjacksonbrownjr/382774/hjacksonbrownjr1.jpg>",
          "author": "H. Jackson Brown, Jr.",
          "created_at": "2018-06-18 08:44:57",
          "updated_at": "2018-06-18 08:44:57"
        }
      ]
    }
    Hi folks, If I am getting a result like this. Do I need to use
    Moshi
    to create a typeconverter to convert this JsonArray?
    g
    • 2
    • 1
  • l

    Lucas Ł

    07/20/2018, 9:24 AM
    how are you using moshi. Are you using a moshi builder?
    g
    a
    • 3
    • 5
  • a

    Ayden

    07/20/2018, 9:40 AM
    My question is not related to Kotlin? 😮
    l
    • 2
    • 1
  • l

    lawlorslaw

    07/21/2018, 8:25 AM
    https://kotlinlang.org/docs/tutorials/android-plugin.html i am trying view binding in a fragment and it doesnt seem to work the way it does for an activity
    a
    • 2
    • 6
  • l

    leosan

    07/23/2018, 2:55 PM
    Would I have any problem/drawback calling an activity on an companion object like that? Memory Leak or something like that?
    companion object {
         
            fun start(context: Context) { 
            launch{
                if (context.prefs.fooProperty) //ext fun on shared pref{
                    val intent = Intent(context, Foo::class.java)
                    context.startActivity(intent)
                }
             }
            }
        }
    r
    u
    • 3
    • 6
  • g

    Gta

    07/23/2018, 3:03 PM
    Quick question. I have an Android library which use kotlin (apply plugin: ‘kotlin-android’) which depends on a java library using kotlin (apply plugin: ‘kotlin’). Can have some conflict or issue later ?
    g
    • 2
    • 1
  • p

    paulex

    07/23/2018, 7:26 PM
    why does code get buggy certain times when the kotlin plugin is updated
    s
    r
    g
    • 4
    • 8
Powered by Linen
Title
p

paulex

07/23/2018, 7:26 PM
why does code get buggy certain times when the kotlin plugin is updated
s

Seri

07/23/2018, 8:08 PM
you probably need to gradle resync
p

paulex

07/23/2018, 8:32 PM
i think it has to do with google adding annotations to libraries
e.g getting complaints like "overrides nothing"
r

rook

07/23/2018, 9:01 PM
overrides nothing
means that the signature of the thing being overridden doesn’t match anything in the object’s inheritance
p

paulex

07/23/2018, 9:19 PM
Yes... buh this warnings comes from onCreateView : inflater onSavedInstance: bundle PS: i just updated kotlin plugin and support library
r

rook

07/23/2018, 9:24 PM
I wouldn’t be able to check myself without actually seeing your code, but I would investigate the objects you think you’re inheriting if I were you to make sure you’re calling what you think you are.
p

paulex

07/23/2018, 11:02 PM
I had to manually go to all my files to fit it. My initial implementation of those methods were like
override fun onSavedInstance(outState:Bundle?)
After updating, it appeared that the parent class is now
public void onSavedInstance(@NonNull outState:Bundle)
Hence kotlin complains that I haven't overriden the proper method e.g overrides nothing Now imagine going to about 20files to fix this
g

gildor

07/23/2018, 11:39 PM
Nothing buggy there and this is not because of Kotlin Plugin, looks that you updated Android support library. Support library annotated some methods with NonNull/Nullable annotation, so Kotlin now concider them as non-nullable/nullable types, not like platform types
👍 3
View count: 5