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

    Saiedmomen

    12/06/2018, 8:43 PM
    I've added core-ktx to my gradle but toast extension function is unresolved what am I missing?
    l
    i
    • 3
    • 7
  • a

    Amir Hossein

    12/07/2018, 9:44 AM
    hello i was wondering is it in the Kotlin plan to do something abut creating UI in android and replacing XML base UI with something sweeter and more flexible for example if you have played with flutter in android you will notice it is a amazing language for creating awesome UI ?
    • 1
    • 1
  • d

    dvlwj

    12/07/2018, 10:56 AM
    guys, can you help me? this is my first trying this in Kotlin. I have a function where i need to use the result from the function in this screenshot, why its gonna jump to line 201 after line 189? Why its not run what inside result.failure or result.success first? edit : because of that what i got is empty string when call this function from other function.
    j
    • 2
    • 29
  • a

    Android75

    12/07/2018, 10:57 AM
    I have my class
    data class (var name:String, surname:String)
    how can i know prop name and value ? I don't want use reflection and "java" Fields
    a
    • 2
    • 1
  • s

    Saiedmomen

    12/07/2018, 7:01 PM
    Does anyone know how to set kotlin compiler args in gradle?
    t
    • 2
    • 1
  • c

    Casey Kulm

    12/07/2018, 8:26 PM
    Are dashes no longer allowed in Intellij module names? I am getting an error trying to add a new one with a dash, although all my previous modules have dashes in the name
    a
    y
    • 3
    • 3
  • t

    tevjef

    12/08/2018, 9:57 PM
    Does anyone know if there is a an Intellij inspection or a lint rule that can mark dependencies as unused?
    class SomeActivity @Inject constructor() {
        @Inject
        lateinit var notUsed: UnusedClass
    }
    Over the years, classes have built up with unused dagger classes
    @Inject
    properties . It’s hard to clean this up manually over an entire codebase.
    r
    j
    • 3
    • 9
  • d

    DJ2

    12/08/2018, 11:08 PM
    Quick quesiton, so
    findViewById
    is no longer necessary,
    val btnSaveClick= findViewById<Button>(R.id.btnSave)
          btnSaveClick?.setOnClickListener {
              Toast.makeText(this@ArticleAdapter, "Article saved.", Toast.LENGTH_LONG).show()
          }
    What should be used instead. I have this in my activity.xml:
    <Button
                android:id="@+id/btnSave"
                android:layout_width="70dp"
                android:layout_height="40dp"
                android:onClick="btnSave"
                android:text="@string/save"
                android:textAlignment="center" />
    t
    t
    • 3
    • 11
  • j

    Javier

    12/08/2018, 11:27 PM
    Is it safe to change from
    g
    • 2
    • 4
  • d

    dewildte

    12/09/2018, 1:52 AM
    Is there an adapter for Retrofit that can generate sealed classes from error codes?
    r
    g
    • 3
    • 9
  • m

    mingkangpan

    12/09/2018, 1:58 AM
    if I use Parcelize annotation, I get an error while compiling, saying I am not implementing the abstract methods, is this supposed to be like that or a bug?
    g
    • 2
    • 2
  • g

    ghedeon

    12/09/2018, 8:35 AM
    Any tricks that you maybe use to hide this long ass styleable ids in your custom classes?
    :stackoverflow: 1
    g
    r
    • 3
    • 7
  • g

    ghedeon

    12/09/2018, 8:36 AM
    a private field with a map of short aliases for this attrs?
    r
    • 2
    • 1
  • d

    DJ2

    12/10/2018, 1:20 AM
    I’m getting an unresolved reference error on
    setOnClickListener
    within an adapter class I have, can’t seem to figure out why
    a
    • 2
    • 1
  • d

    DJ2

    12/10/2018, 8:48 PM
    val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ", Locale.getDefault())
    formatter.timeZone = TimeZone.getTimeZone("UTC")
    val result = formatter.parse(dateTv.text)
    Would this work?
    :stackoverflow: 2
    l
    • 2
    • 2
  • j

    jurajsolarml

    12/11/2018, 7:35 AM
    Hello please help.How do I fix it ? Thanks ?/AS 3.4,Gradle 5,JAVA 11/
    g
    j
    +2
    • 5
    • 34
  • s

    Sergio Casero

    12/11/2018, 10:15 AM
    Hi guys, if you have any issues when you are migrating to AndroidX, (remember that XMLs crash in runtime), you could use this linux command:
    grep -rnw '.' -e 'android.support'
    It returns each ocurrency, with the file and the line
    ./layout/activity_new_incident.xml:33:    <android.support.design.widget.FloatingActionButton
    (edited) I don't know if we can improve the command, moving into a script (in order to add it to CI or whatever) If anyone have any suggestions, feel free to post any updates -> https://gist.github.com/sergiocasero/fab62dfbeb303b49c1991b909cb3cf19 PD: I know this is an easy command, it just for sharing 🙂
    👍 4
    👍🏾 9
    r
    • 2
    • 1
  • s

    sanogueralorenzo

    12/11/2018, 3:04 PM
    Hello everyone! Just noticed that in Android project view my top level build.gradle is not showing 🤔 just curious what broke it. Anyone experienced the same thing?
    m
    • 2
    • 2
  • d

    dangvh

    12/11/2018, 7:28 PM
    Hi everybody, I have a question. I have 3 fragments: main, about,setting. I want to set main fragment default when start app ? How to do it ? #android
    :google: 2
    :stackoverflow: 4
    m
    j
    • 3
    • 4
  • g

    gsala

    12/12/2018, 10:31 AM
    I have a problem with Kotlin enums and Moshi. It seems like when I annotate an enum member with
    @Json(name = "xx")
    , the serialized string has the name of the enum member itself instead of the value passed into the annotation. Has anyone run into this problem before?
    i
    e
    • 3
    • 8
  • s

    Saiedmomen

    12/12/2018, 11:48 AM
    I sometimes get null from "Kotlin android extensions synthetic binding" although the view is created and in resumed state. Weird thing is if I access the binding in
    onViewCreated
    with an empty
    apply
    the binding works properly. Here is a question I asked on stackoverflow when I first encountered the issue https://stackoverflow.com/questions/48971322/kotlin-android-extension-fragment-view-null Has anyone else experieced this issue?
    r
    • 2
    • 10
  • s

    Saiedmomen

    12/12/2018, 11:57 AM
    Here is the project I'm currently working on and has this issue. https://github.com/saied89/FilmCompass
    i
    • 2
    • 3
  • t

    tevjef

    12/12/2018, 5:17 PM
    Anyone know the difference between
    val a: String? = b as String?
    and
    val a: String? = b as? String
    e
    e
    i
    • 4
    • 3
  • j

    Jakub

    12/13/2018, 9:38 AM
    -.php
    a
    j
    +2
    • 5
    • 22
  • b

    bodo

    12/13/2018, 10:30 AM
    message has been deleted
    s
    • 2
    • 7
  • c

    Corentin Leffy

    12/13/2018, 11:13 AM
    Hello there, I have a question about spread operator. Currently, detekt want me to remove the spread operator because of the copy of the array (here
    params
    ). But how can I avoid it ? Thank you !
    -.kt
    p
    • 2
    • 2
  • p

    Paul Woitaschek

    12/13/2018, 4:46 PM
    It seems that android lint does not cover this and I want to make it part of my ci pipeline
    d
    s
    +2
    • 5
    • 8
  • i

    Icaro Temponi

    12/13/2018, 7:13 PM
    Hi everyone, just a quick question: For everyone using coroutines, when do you think it's best to cancel the children jobs of a lifecycle owner? I'm currently using in onStop, which is kind of balanced, not too often but not as rare as once when the component is destroyed, what are your thoughts?
    j
    p
    • 3
    • 6
  • l

    lawlorslaw

    12/14/2018, 8:55 AM
    if i have a
    List<Tide>
    where a
    Tide
    has a field
    tide
    that is of type
    Float
    , what is the best way to sort by the
    tide
    field? I tried
    tides.sortedBy { it.tide }
    but it throws a ClassNotFoundException
    j
    p
    r
    • 4
    • 6
  • z

    zokipirlo

    12/14/2018, 9:32 AM
    I have a custom Application class which I want to convert to Interface and currently a lot of methods thinks that it's also Context, but when I change to Interface it's of course not, even when I implemented that interface it becomes, because implementation class extends Application. Is it possible to create an Interface which is somehow marked that is also Context? Something like expect functions.
    k
    • 2
    • 2
Powered by Linen
Title
z

zokipirlo

12/14/2018, 9:32 AM
I have a custom Application class which I want to convert to Interface and currently a lot of methods thinks that it's also Context, but when I change to Interface it's of course not, even when I implemented that interface it becomes, because implementation class extends Application. Is it possible to create an Interface which is somehow marked that is also Context? Something like expect functions.
k

kagomez

12/14/2018, 11:47 AM
Why would you like to do that? and no, Context is not an interface so it can't be inherit by your interface; interfaces can only inherit other interfaces
z

zokipirlo

12/14/2018, 1:14 PM
I need to merge two applications together and can't extend from two classes. I fixed with exposing getContext method and calling it when I need it.
View count: 2