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

    rkeazor

    06/08/2018, 11:15 AM
    You probably should have used feature modules.
    n
    m
    • 3
    • 17
  • a

    Ayden

    06/08/2018, 4:08 PM
    @Luke if that's the case, should I change it?
    l
    • 2
    • 10
  • a

    Ayden

    06/08/2018, 5:06 PM
    And inside the class I can indicate the parameter?
    l
    • 2
    • 3
  • y

    yanek_

    06/09/2018, 2:06 PM
    smth wrong with the plugin I guess
    r
    • 2
    • 17
  • l

    Lukas Anda

    06/10/2018, 7:08 AM
    Hi guys, anyone knows a way to do the blue floating info view YouTube app uses for showing info for buttons ? I simply can not find the name of it.
    :stackoverflow: 2
    d
    • 2
    • 1
  • g

    gildor

    06/10/2018, 12:28 PM
    Yes, stdlib is required. Probably some of your dependencies use stdlib and you see this transitive dependency. You can check it using
    ./gradlew :app:dependencies
    👌 2
    s
    • 2
    • 1
  • d

    DanDPanda

    06/10/2018, 3:37 PM
    Here's what I have
    val queue = Volley.newRequestQueue(this)
                    val url = "<https://api.fortnitetracker.com/v1/profile/${platformText}/${usernameText}>"
                    val stringRequest = StringRequest(Request.Method.GET, url,
                            Response.Listener<String> {
                                response -> println(response)
                            },
                            Response.ErrorListener {
                                println("Request didn't work")
                            }) 
                    queue.add(stringRequest)
    j
    g
    • 3
    • 5
  • k

    kartikpatodi

    06/10/2018, 8:47 PM
    when I try to use databinding it generates
    android.support.constraint.ConstraintLayout
    instead of
    androidx
    equivalent
    r
    g
    • 3
    • 68
  • n

    nickk

    06/11/2018, 10:10 AM
    I am trying to create the view for a
    PopupWindow
    using
    anko
    . However, my button handlers run as soon as the popup is presented, and the buttons do not respond to tapping. Any idea?
    kotlin
        private fun showAlert() {
            // Get the Activity root view
            val viewGroup = (findViewById<View>(android.R.id.content) as ViewGroup).getChildAt(0) as ViewGroup
    
            val ui = AnkoContext.create(this)
    
            val customView = with(ui) {
                verticalLayout {
                    backgroundColor = Color.DKGRAY
                    padding = dip(10)
    
                    button("One") {
                        alert("Hi there") {
                            yesButton { }
                        }.show()
    
                    }
    
                    button("Two") {
                        longToast("Ooops")
                    }
    
                }
            }
    
            val popup = PopupWindow(customView,
                    ViewGroup.LayoutParams.WRAP_CONTENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT)
    
            popup.showAtLocation(viewGroup, <http://Gravity.TOP|Gravity.TOP>, 0, 0)
        }
    g
    • 2
    • 3
  • g

    ghedeon

    06/11/2018, 3:53 PM
    synthetic autocomplete gives you a hint where this ID comes from, but yeah, you'd need to keep an eye on your imports. On the other hand, the wrong import will fail pretty fast, which is a good thing... Actually, this topic bothers me for a long time already, to the extent that I wrote an AS plugin that exports all the IDs with customizible aliases, lol) Something like this:

    https://i.imgur.com/Bdg931e.gif▾

    👍🏼 2
    👍 4
    t
    a
    • 3
    • 4
  • d

    Diefferson

    06/11/2018, 8:38 PM
    Hi, is possible I create a Intent to show android widgets selection screen, with widgets of my app?
    :google: 4
    :stackoverflow: 9
    d
    • 2
    • 1
  • w

    wck

    06/12/2018, 12:38 AM
    Hi, anyone here has idea on when this issue will be fixed? We are planning on modularise our app but found kotlin android extension doesn’t support multi modules yet.
    p
    • 2
    • 7
  • r

    rkeazor

    06/12/2018, 1:35 PM
    I think it became a thing because that's how the folks at Google were doing it in there APIs at one time. But they later called it a bad decision
    l
    • 2
    • 2
  • k

    kenkyee

    06/12/2018, 7:44 PM
    hmm...that I haven't tried. Trying to parcelize a data class definitely causes compile errors
    r
    • 2
    • 2
  • s

    Slackbot

    06/12/2018, 9:56 PM
    This message was deleted.
    :stackoverflow: 3
    l
    a
    • 3
    • 3
  • r

    rattleshirt

    06/13/2018, 12:29 PM
    Anyone ran into issues with coroutines because of multidex? For some reason it cannot find a specific suspend fun in one of the dex files from a coroutine context.
    s
    • 2
    • 2
  • k

    Kevin Janvier Chinabalire

    06/13/2018, 9:20 PM
    Hey guys ... am trying to convert Any to an Object Class Any Idea ?
    fun bindview(pool:Any){
    //want to convert 
    }
    I have my class
    class Users(var name, var id)
    m
    e
    • 3
    • 11
  • j

    jw

    06/13/2018, 9:33 PM
    the problem will naturally dissipate over time, but you don't want to bundle any of those files anyway
    👍 3
    d
    • 2
    • 3
  • l

    Laci

    06/14/2018, 6:03 AM
    Hello, I updated to kotlin 1.2.50 and I set the "kapt.use.worker.api=true" in the gradle.properties file and I got this error:
    File '/Users/takacsl/Documents/MyApp/MyAndroid/Android/app' specified for property 'projectDir' is not a file.
    k
    • 2
    • 1
  • k

    kenkyee

    06/14/2018, 4:20 PM
    Anyone get these spurious warning msgs w/ the latest Kotlin 1.2.50 plugin? Classpath entry points to a non-existent location: /Users/kyee/work/android/app/src/debug/kotlin
    j
    • 2
    • 1
  • f

    freddiewang

    06/15/2018, 10:07 AM
    I met the same problem as this one https://stackoverflow.com/questions/49051453/arrayadapter-addall-type-mismatch#, does anyone know the better solution? I am using kotlin 1.2.50
    j
    • 2
    • 2
  • l

    ludwig

    06/15/2018, 10:33 AM
    @nikolay Yes, sorry, that is correct, it was a typo in the example
    n
    • 2
    • 52
  • o

    oday

    06/15/2018, 9:05 PM
    very nice
    u
    • 2
    • 1
  • y

    yaakov

    06/15/2018, 10:24 PM
    Oh well, fixed it by invalidate and restart option.
    k
    • 2
    • 1
  • e

    edwardwongtl

    06/16/2018, 4:41 PM
    I should put it this way, the
    jsonTodo
    is the data you need to write, together with the
    id
    , instead of removing it from the call site, what you should do it adding that to the function signature so that the function can receive both information you need.
    n
    r
    v
    • 4
    • 38
  • a

    amanda.hinchman-dominguez

    06/16/2018, 7:58 PM
    Not sure where it is best to ask, but I'm building a mobile application with 2 friends and we're interested in cross platform for iOS/Android. We'd like to develop natively, but we haven't had much experience in native mobile development - we're still between express and Kotlin for backend, but I'd like to push for Kotlin if it's possible for cross-platform work. Otherwise, we'll be looking at React native. Any thoughts?
    o
    s
    r
    • 4
    • 5
  • a

    Ayden

    06/17/2018, 1:05 AM
    Good morning everyone. I would like to know how to use Retrofit for an ArrayList. I tried to find solution from SO. Most of them are Java I managed to convert them into Kotlin but I am still getting error.
    MainActivity.kt
    fun retrieveApiData() {
    	val vibeApi: VibeApi
    	var vibeList = mutableListOf<Vibes>()
    
    	val retrofit: Retrofit = Retrofit.Builder()
    								.baseUrl(Constants.baseUrl)
    								.addConverterFactory(MoshiConverterFactory.create())
    								.build()
    
    	vibeApi = retrofit.create(VibeApi::class.java)
    
    	val call = vibeApi.getVibes()
    
    	// Object is not abstract and does not implement abstract member public abstract fun onResponse(call: Call<kotlin.collections.ArrayList<VibeList> /* = java.util.ArrayList<VibeList> */!>!, response: Response<kotlin.collections.ArrayList<VibeList> /* = java.util.ArrayList<VibeList> */!>!): Unit defined in retrofit2.Callback
    	call.enqueue(object: Callback<ArrayList<VibeList>> {
    		
    		// Modifier 'override' is not applicable to 'local function'
    		override fun onResponse(call: Call<Vibes>?, response: Response<Vibes>?) {
    			var vibes = response?.body()
    		}
    
    		// Modifier 'override' is not applicable to 'local function'
    		override fun onFailure(call: Call<Vibes>?, t: Throwable?) {
    			Log.d("Vibe Adapter", "Failure")
    		}
    	})
    }
    DataClass
    
    data class Vibes(@Json(name = "result") val vibeList: ArrayList<VibeList>)
    
    data class VibeList(
            @Json(name = "id") val id: Integer?,
            @Json(name = "url") val url: String?,
            @Json(name = "author") val author: String?)
    r
    t
    • 3
    • 17
  • f

    freddiewang

    06/18/2018, 8:57 AM
    Hi I found that kapt would generate some stub with
    @android.annotation.TargetApi(value = null)
    in my project and it would cause build fail. does anyone know how to avoid it?
    r
    • 2
    • 6
  • k

    kartikpatodi

    06/18/2018, 11:00 PM
    what is the difference between
    androidx.constraintlayout.widget.ConstraintLayout
    and
    androidx.constraintlayout.ConstraintLayout
    ?
    g
    a
    • 3
    • 3
  • a

    arekolek

    06/19/2018, 9:03 AM
    Does accessing a property annotated with
    @VisibleForTesting
    generate a warning in Kotlin for you?
    g
    s
    • 3
    • 4
Powered by Linen
Title
a

arekolek

06/19/2018, 9:03 AM
Does accessing a property annotated with
@VisibleForTesting
generate a warning in Kotlin for you?
g

gildor

06/19/2018, 9:08 AM
Doesn’t work for me, only for methods. Would be nice to report it to Google
a

arekolek

06/19/2018, 9:13 AM
Thanks for checking that
s

skennedy

06/19/2018, 4:55 PM
@get:VisibileForTesting
?
g

gildor

06/19/2018, 4:57 PM
I tried, doesn’t work for me
View count: 4