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

    bostonmacosx

    10/01/2017, 2:59 AM
    oh well here it goes sorry if I'm not allowed https://stackoverflow.com/questions/46505805/having-issues-writing-to-edittext-in-kotlin
    d
    • 2
    • 5
  • m

    MiSikora

    10/01/2017, 4:20 PM
    Can I make Room work with separate Gradle modules and Kotlin? When I define a class like below in one module and build a database in another one I get a compilation error regarding parameter naming.
    data class Round(
        @ColumnInfo(name = "id")
        val id: Long,
    
        @ColumnInfo(name = "name")
        val name: String,
    
        @ColumnInfo(name = "description")
        val description: String,
    
        @ColumnInfo(name = "measurements_count")
        val measuredCount: Int
    )
    Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).
    
    Tried the following constructors but they failed to match:
    Round(long,java.lang.String,java.lang.String,int) : [arg0 : null, arg1 : null, arg2 : null, arg3 : null]
    g
    • 2
    • 6
  • j

    jw

    10/01/2017, 7:14 PM
    ignore it
    :trollface: 4
    b
    • 2
    • 1
  • a

    afernan

    10/01/2017, 7:40 PM
    I'm trying to generate JSON schemas from my data classes, does anyone know of a library that does this?
    b
    • 2
    • 2
  • c

    codeslubber

    10/02/2017, 3:29 PM
    Using the new MVP Architecture Patterns (which are pretty awesome btw) on O and wiring up a ViewModel, came across this in the docs:
    public class MyActivity extends AppCompatActivity {
        public void onCreate(Bundle savedInstanceState) {
            MyViewModel model = ViewModelProviders.of(this).get(MyViewModel.class);
            model.getUsers().observe(this, users -> {
                // update UI
            });
        }
    }
    Obviously this is Java. In getting a syntax for the observer that would compile in Kotlin, I ended up doing an Observer<ModelType>(){} construct, is this as it should be?
  • c

    codeslubber

    10/02/2017, 6:43 PM
    ok nm this works (and is quite pretty):
    conversionViewModel?.getConversion()?.observe(this, Observer<Conversion>{ conversion ->
                println("observer called with conversion: $conversion")
            })
    and simple.
    a
    • 2
    • 4
  • g

    gabrielfv

    10/02/2017, 7:49 PM
    I know this isn't exactly kotlin related, but I think you guys might have some good advice. I need to manage a pub-sub connection between an android device and a server. Ideally, that means the app would need to listen to the server. How would you manage that? Periodically raise a connection (the server keeps messages on a buffer and fire them as soon as there is a connection established)? The app needs to at least look real time (instantly fire messages sent from app, receive messages without much delaying).
    :stackoverflow: 8
    e
    v
    • 3
    • 4
  • s

    Slackbot

    10/02/2017, 9:31 PM
    This message was deleted.
    :stackoverflow: 3
    o
    • 2
    • 2
  • c

    codeslubber

    10/02/2017, 10:04 PM
    the MVP arch documentation is really good but really needs Kotlin examples and documentation
    t
    • 2
    • 3
  • s

    sqia09

    10/03/2017, 8:51 AM
    someone who know about a good resource to implement an expandable recyclerview?
    :stackoverflow: 7
    d
    • 2
    • 1
  • m

    myanmarking

    10/03/2017, 11:33 AM
    well i dont know if it is reported, but the bug is the following
    j
    • 2
    • 1
  • j

    jean pokou

    10/03/2017, 1:27 PM
    has anybody faced this bug :
    Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
    > com.android.build.api.transform.TransformException: org.gradle.tooling.BuildException: com.android.dx.cf.code.SimException: local 0007: invalid
    l
    • 2
    • 3
  • m

    myanmarking

    10/04/2017, 10:30 AM
    idk the kotlin way =(
    g
    e
    • 3
    • 8
  • b

    brent

    10/04/2017, 3:58 PM
    Might have more luck with Rx for cancelation @efemoney
    e
    • 2
    • 4
  • t

    tapchicoma

    10/05/2017, 8:48 AM
    Hi, why
    const
    is not allowed for field that references generated const classes like android
    R
    subclasses? IMHO, technically it should be allowed. For example,
    const val TEXT_RES = R.string.some_text
    g
    g
    • 3
    • 9
  • c

    codeslubber

    10/06/2017, 6:08 AM
    The Volley documentation recommends implementing a Singleton so the RequestQueue would be retained throughout the app. Of course it shows it in Java. While the J code is kind of bizarre (the class is called MySingleton), it is pretty simple. It can be found here: https://developer.android.com/training/volley/requestqueue.html. I did find a post on medium about implementing Singleton in Kotlin when you have an argument. Seemed like a LOT of work/mess. Anyway, is that the best solution? to just do it with the approach described here: https://medium.com/@BladeCoder/kotlin-singletons-with-argument-194ef06edd9e
    g
    • 2
    • 3
  • s

    sqia09

    10/06/2017, 12:56 PM
    Hey, I'm getting this error:
    EquipmentLayer is not Comparable
    while writing a recyclerview adapter implementation using the following link: https://github.com/thetonrifles/stackoverflow/tree/so-34848401
    • 1
    • 1
  • m

    menegatti

    10/06/2017, 3:32 PM
    sealed class Response
    data class Success(val body : Data) : Response
    data class Failure(val error : Throwable) : Response
    ...
    if (res is Success) {
        updateUi(res.body)
    }
    t
    l
    • 3
    • 2
  • h

    hetang

    10/06/2017, 4:13 PM
    any one using Kotlin, Dagger 2, Espresso & mockito for android test?
    🙋 11
    t
    • 2
    • 2
  • s

    Sean Patterson

    10/06/2017, 9:02 PM
    Can anyone recommend a good resource for learning kotlin for android?
    a
    f
    • 3
    • 3
  • r

    rkeazor

    10/07/2017, 4:42 PM
    anyone having multidex issues with Android Studio 3.0?
    b
    • 2
    • 2
  • l

    langara

    10/08/2017, 2:35 PM
    Check out my new article about simple android app using coroutines: https://blog.elpassion.com/create-a-clean-code-app-with-kotlin-coroutines-and-android-architecture-components-f533b04b5431
    👍 7
    d
    • 2
    • 1
  • d

    DF595

    10/08/2017, 6:26 PM
    hi there I trying kotlin but does not understand the problem here: https://stackoverflow.com/questions/46634473/kotlin-toolbar-menu-icon-issue. Maybe someone can help me?
    e
    • 2
    • 1
  • k

    Kulwinder Singh

    10/10/2017, 6:21 AM
    I want to know why I have to pass dataManager(instance of DataManager), I only want that when I call getData() ,then at call time I have to pass function of DataManager that takes only parameter WebDataListener<T>
    e
    • 2
    • 10
  • n

    Neil

    10/10/2017, 11:33 AM
    Our model classes and networking code (retrofit) is defined in a pure-Java library project which is a dependency of the Android project. I've added a new model as a kotlin data class - all seems good. But I now want to use it in the view layer (databinding FTW) and so make it parcelable to survive rotate. The pure-Java project can't see android.os.Parcelable. A data class can't be extended. I can lose some convenience by dropping 'data' so I can extend but as the properties are defined in the constructor the subclass needs to list all the properties again which is a lot of duplication adding a maintenance burden. Is there a pattern I should follow here please?
    g
    • 2
    • 1
  • j

    joelpedraza

    10/10/2017, 2:01 PM
    Architecture components uses a ViewModel. The app I'm working on now is older than Arch components, so I've not had a chance to dig into it. The app uses Presenters whose lifecycle is managed by the framework via the Loader apis
    n
    • 2
    • 1
  • m

    murt

    10/10/2017, 3:20 PM
    but I putted
    ?
    end the end
    v
    • 2
    • 1
  • d

    doug

    10/11/2017, 4:27 PM
    I’m using all of these
    dependencies {
            classpath ‘com.android.tools.build:gradle:2.3.2’
            classpath ‘org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.4-2’
            classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.4’
            classpath ‘io.fabric.tools:gradle:1.+’
            classpath ‘de.undercouch:gradle-download-task:2.1.0’
            classpath ‘me.tatarka:gradle-retrolambda:3.2.4’
            classpath ‘com.google.gms:google-services:3.0.0’
            classpath ‘com.github.triplet.gradle:play-publisher:1.2.0’
        }
    t
    • 2
    • 1
  • s

    Sandip75

    10/12/2017, 8:56 PM
    fun main(args:Array<String>) { var n:Int = readLine()!!.toInt() var a:Array<Int> = Array<Int>(n){readLine()!!.toInt()} for (num in a){ } var k:Int = readLine()!!.toInt() for(num1 in 0..n){ if(a[num1]==k){ print(num1) return } } }
    o
    • 2
    • 1
  • s

    Sandip75

    10/12/2017, 8:56 PM
    Why I am getting error
    o
    • 2
    • 1
Powered by Linen
Title
s

Sandip75

10/12/2017, 8:56 PM
Why I am getting error
o

orangy

10/12/2017, 8:59 PM
Please provide an error you’re getting. Also it doesn’t look like Android question, try #getting-started
View count: 1