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

    dragas

    06/17/2017, 12:18 PM
    @radityagumay And why's that? It's pretty straight forward that when you don't want to leak something, you use weak references. If you don't want to reference contexts, use handlers and post messages to main thread.
    r
    • 2
    • 1
  • l

    leodeleon

    06/17/2017, 12:40 PM
    @BindString(R.string.favorites) internal var favorites: String? = null
    r
    • 2
    • 4
  • l

    leodeleon

    06/17/2017, 2:32 PM
    I tried without the
    view
    no success
    n
    • 2
    • 2
  • l

    leodeleon

    06/17/2017, 8:47 PM
    https://github.com/leodeleon22/PopularMovies/tree/master/app/src/main/java/com/leodeleon/popmovies
    👍 4
    r
    • 2
    • 4
  • n

    nhaarman

    06/18/2017, 8:40 AM
    Note it still uses
    findViewById
    instead of
    _$_findCachedViewById
    . Is it a bug? Or is there something else going on with view classes? The Activity generated code does use the proper method.
    r
    • 2
    • 2
  • b

    bodo

    06/18/2017, 8:46 AM
    Hi. I am using "kotlin-android-extensions" in my apps. Now i focused a problem when the layout file is declared i another module, e.g. MODULE-A -> fragment_recyclerview MODULE-B -> Fragment which uses this layout file The import ist made correct (in Fragment of Module B): import kotlinx.android.synthetic.main.fragment_recyclerview.contentView But if i want to run the app the comiler throws this error: Unresolved reference: fragment_recyclerview Unresolved reference: contentView So my question: Is it not possible to access layout ids from layout files of different modules with android extensions?
    n
    r
    • 3
    • 11
  • k

    kartikpatodi

    06/18/2017, 12:58 PM
    @here I need some advice I am learning android development and I am confused which language should i prefer for backend python or php. I know some python but zero knowlege of PHP
    r
    • 2
    • 1
  • v

    vickyc

    06/18/2017, 2:01 PM
    Hi! I just launched Kotlin Kōans, an app to help developers learn Kotlin through a series of 40+ short coding challenges (credits for the content go to Jetbrains). If you're in the process of learning Kotlin, take a look! Play store: https://play.google.com/store/apps/details?id=me.vickychijwani.kotlinkoans Demo: http://i.imgur.com/UTmcU39.gifv Code: https://github.com/vickychijwani/kotlin-koans-android Feedback is welcome 🙂
    👏 15
    k
    v
    +2
    • 5
    • 16
  • w

    wilburt

    06/18/2017, 11:35 PM
    Is there plug-in to generate parcellables in Kotlin like in former java POJO classes?
    s
    • 2
    • 12
  • g

    gildor

    06/19/2017, 6:18 AM
    @Loránd Inner classes in Kotlin by default work as static inner in java, so no implicit reference. To create inner class with implicit parent reference you should add “inner” modifier to a inner class
    ❤️ 3
    w
    • 2
    • 3
  • g

    gildor

    06/19/2017, 7:50 AM
    @louiscad Try to install plugin manually (download zip file and install - https://plugins.jetbrains.com/plugin/6954-kotlin)
    l
    • 2
    • 1
  • m

    marcinmoskala

    06/19/2017, 9:41 AM
    I would like to announce, that Packt publishing started distribution of new book "Android Development with Kotlin" by @igor.wojda and @marcinmoskala. We've been working on this book for last 12 months. Book is mainly addressed to Android developers who wants to migrate into Kotlin and explore it’s potential. https://www.packtpub.com/application-development/android-development-kotlin
    👍 2
    l
    • 2
    • 2
  • j

    jw

    06/19/2017, 2:11 PM
    so you won't be able to upgrade it through the normal means (which could potentially break compatibility)
    w
    • 2
    • 2
  • r

    radityagumay

    06/20/2017, 5:28 AM
    Hi, anyone have solve this issus? kotlin version that is used for building with gradle (1.1.2-5) differs from the one bundled into the IDE plugin (1.1.2-4) i am using AS 3.0 Canary 4
    c
    • 2
    • 3
  • v

    vivekneel

    06/20/2017, 5:55 AM
    Anyone was successfully able to use dagger in project which uses both java and kotlin? I'm not able to inject in kotlin classes
    r
    r
    w
    • 4
    • 27
  • m

    morozov

    06/20/2017, 9:01 AM
    In this code i need to write
    return true
    My function:
    override fun onBackPressed(): Boolean {
            if (amountCalculator?.visible ?: false)
                amountCalculator?.let { it.toggle(presenter.goal.amount) }
            else if (initialBalanceCalculator?.visible ?: false)
                initialBalanceCalculator?.let { it.toggle(presenter.goal.initialBalance) }
            else return false
            return true
        }
    😲 2
    s
    • 2
    • 9
  • d

    dathoang.se

    06/20/2017, 9:15 AM
    Anyone encountering “unresolved reference: databinding” issue when using kotlin + databinding in Android? “Error:(8, 38) Unresolved reference: databinding Error:(15, 35) Unresolved reference: ActivitySignupBinding”
    l
    s
    • 3
    • 6
  • m

    morozov

    06/20/2017, 9:48 AM
    @menegatti i m not sure)
    m
    • 2
    • 5
  • t

    trevjones

    06/20/2017, 5:11 PM
    check that your import is for a supportv4 fragment not the android app fragment
    👍 2
    j
    • 2
    • 1
  • b

    btilbrook-nextfaze

    06/20/2017, 11:53 PM
    I can’t seem to disable Kotlin incremental compilation on a Gradle build. I’m using
    1.1.3-eap-85
    and `com.android.tools.build:gradle:3.0.0-alpha4`:
    ./gradlew -Pkotlin.incremental=false clean assembleRelease
    ./gradlew -Pkotlin.incremental=false assembleRelease // Prints "Using kotlin incremental compilation"
    My goal is to disable it for CI builds, preferably without having to configure the CI environment globally by using special
    ~/.gradle/gradle.properties
    configuration.
    r
    • 2
    • 3
  • s

    sidharthanil

    06/21/2017, 7:58 AM
    But when I tried to convert it looked like ``` val httpClient = OkHttpClient.Builder() httpClient.addInterceptor(object : Interceptor() { @Throws(IOException::class) fun intercept(chain: Interceptor.Chain): Response { val original = chain.request() // Request customization: add request headers val requestBuilder = original.newBuilder() .addHeader("Cache-Control", "no-cache") .addHeader("Cache-Control", "no-store") val request = requestBuilder.build() return chain.proceed(request) } }) val client = httpClient.build()
    g
    • 2
    • 1
  • l

    lovis

    06/21/2017, 10:00 AM
    when(viewID) {
        R.id.some -> fun3()
    }
    
    ...
    fun fun3() { 
      fun1()
      fun2()
    }
    👍 2
    😉 2
    m
    • 2
    • 3
  • s

    sikanderbhutto

    06/21/2017, 10:45 AM
    how to TextView textView in kotlin
    g
    l
    • 3
    • 8
  • p

    Paul Woitaschek

    06/21/2017, 1:11 PM
    @karelpeeters the issue is completely vague. It just talks about a plan.
    k
    • 2
    • 1
  • w

    wesjon

    06/21/2017, 1:32 PM
    Hi there. Is anyone also having issues with the layout editor on AS 3.0 not rendering customViews written in Kotlin? I've filed an issue but didn't get any reply yet
    n
    • 2
    • 1
  • s

    szymen

    06/21/2017, 4:30 PM
    Is there any library, which contains many useful viewgroups extensions? I mean extensions like showed in this presentation:

    https://www.youtube.com/watch?v=fPzxfeDJDzY▾

    b
    m
    • 3
    • 2
  • v

    vivekneel

    06/21/2017, 10:59 PM
    Hi , What's wrong with this data class?
    @Entity(
            tableName = "template"
    )
    data class ListTemplate (
            @PrimaryKey(autoGenerate = true) var id: Long = 0L,
            @SerializedName("name") var name: String = "",
            @SerializedName("thumbnail") var thumbnail: String=  "",
            @SerializedName("category") var category: String = "",
            @SerializedName("totalAmount") var totalAmount: Long = 0L,
            @SerializedName("currency") var currency: String = ""
    )
    studio is throwing an error saying
    Error:Type of the parameter must be a class annotated with @Entity or a collection/array of it.
    g
    • 2
    • 2
  • s

    sikanderbhutto

    06/22/2017, 6:44 AM
    checkBox.setOnCheckedChangeListener
    g
    • 2
    • 3
  • c

    chanzmao

    06/22/2017, 10:22 AM
    apply plugin: ‘kotlin-android’ apply plugin: ‘kotlin-android-extensions’ apply plugin: ‘kotlin-kapt’
    b
    • 2
    • 47
  • a

    aakaashjois

    06/22/2017, 4:54 PM
    Hey! Like how
    Snackbar
    class has a static function
    make
    which allows us to create a
    Snackbar
    , can I use Kotlin extension function on the
    Snackbar
    class to create a static method similar to
    make
    ?
    r
    k
    p
    • 4
    • 6
Powered by Linen
Title
a

aakaashjois

06/22/2017, 4:54 PM
Hey! Like how
Snackbar
class has a static function
make
which allows us to create a
Snackbar
, can I use Kotlin extension function on the
Snackbar
class to create a static method similar to
make
?
r

radityagumay

06/22/2017, 6:23 PM
aakaashjois: Yes
a

aakaashjois

06/22/2017, 6:41 PM
Can you please tell me how I can do that?
k

kirillrakhman

06/22/2017, 8:50 PM
You can do that for kotlin classes that have companion objects by writing extension functions for the companion object. You can't do that for Java classes
a

aakaashjois

06/23/2017, 3:56 AM
Thank you! I wanted to do it for the Snackbar class. I hope this feature gets implemented in the future for Java classes as well.
p

pablisco

07/07/2017, 1:16 PM
https://youtrack.jetbrains.com/issue/KT-11968
r

radityagumay

08/19/2017, 5:35 PM
fun Snackbar.something(){ // doing what you want }
View count: 7