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

    kingsley.gomes

    12/14/2018, 1:35 PM
    @here How to test if an 'inline function' is called i.e
    verify {fixedRateTimer(0, 1000) {function}}
    I am using mockk Any help/pointers would be much appreciated
    i
    o
    • 3
    • 3
  • m

    matt tighe

    12/14/2018, 9:19 PM
    is it possible to post values to a mutable livedata from a coroutine? i’m trying to emit state updates from a long-running background process. something like this: (apologies for using experimental still)
    fun doLongProcess() = runBlocking {
        async {
            state.postValue("starting process")
            startLongProcess()
        }
    }
    r
    m
    • 3
    • 2
  • l

    liminal

    12/16/2018, 5:51 AM
    Does anyone know how to intercept `MutableLiveData`'s
    setValue(T)
    and
    postValue(T)
    to log the new value, for example? Do I need to implement a Delegate? I have a standard
    ViewModel
    setup with
    MutableLiveData
    and
    LiveData
    and would like to log (within the
    ViewModel
    itself) every time the value changes.
    :stackoverflow: 3
    • 1
    • 1
  • p

    Paul Woitaschek

    12/17/2018, 8:54 AM
    You can just write it as
    class IcebergViewHolder(override val containerView: View) : RecyclerView.ViewHolder(containerView), LayoutContainer
    @Jorge R
    🤯 3
    🤔 1
    j
    • 2
    • 8
  • a

    Aleksey Kornienko

    12/17/2018, 12:33 PM
    Hello! When I try to implement kotlin-written aar library in java only project I get an error “Error: Program type already present: com.mylibrary.internal.event.EventKeys$Alive$Companion” So, this means that I can’t use kotlin jars/aars in non-kotlin projects?
    n
    • 2
    • 13
  • n

    nwh

    12/17/2018, 8:51 PM
    Is there a kotlin library for supporting expandable layouts like this? (Or for Cards in general) https://storage.googleapis.com/spec-host-backup/mio-design%2Fassets%2F1MQkoHF02iEg52BoUbsNG4Eu3wuyYRmsQ%2Fcards-behavior-do.mp4
    r
    • 2
    • 6
  • l

    lawlorslaw

    12/19/2018, 4:43 AM
    so i have an api call that returns Single<List<Spot>>, i want to iterate through that list and make an api call for each spot in that list, then once i get the result of the second api call which will be a Single<List<Forecast> i want to operate on that list. how do i do that?
    h
    d
    • 3
    • 13
  • n

    nickk

    12/19/2018, 6:11 PM
    Can someone from JetBrains clarify if anko is still actively developed? I use it a lot in my project, and I have started to fear it is being silently abandoned, which would be REALLY unfortunate.
    ☝️ 6
    i
    h
    +3
    • 6
    • 7
  • j

    Jorge R

    12/19/2018, 10:31 PM
    Hi all, after reviewing the material design guidelines for Top bar, I've seen a prominent mode. Do you know how to achieve it? there is no documentation in there how to set that mode. Thanks!
    :stackoverflow: 5
    g
    • 2
    • 3
  • l

    lawlorslaw

    12/20/2018, 9:13 AM
    how do you take an Observable<Spot> which has N emissions and turn it into a Single<List<Spot>> which has all N emissions?
    t
    e
    p
    • 4
    • 17
  • j

    jaran

    12/20/2018, 10:21 AM
    Hi, can anyone quickly explain to me the difference between the two following imports from the Kotlin Android Extensions?
    Kotlin_Android_Extensions_imports.txt
    h
    • 2
    • 2
  • l

    lawlorslaw

    12/20/2018, 10:33 AM
    How do you filter multiple items from a list in Kotlin?
    j
    • 2
    • 1
  • l

    lawlorslaw

    12/20/2018, 10:37 AM
    is there a shorthand way to do that in Kotlin
    m
    • 2
    • 1
  • l

    lawlorslaw

    12/20/2018, 10:40 AM
    -.kt
    m
    • 2
    • 5
  • t

    tevjef

    12/20/2018, 6:09 PM
    Anyone know of a way to get a coverage report of code execution without doing a normal instrumentation test? I want to run and exercise my app normally. Then exit and see a coverage report of the exercise in Android Studio. This would help immensely when refactoring old code to smoke test nothing was broken.
    :stackoverflow: 1
    p
    • 2
    • 2
  • n

    nwh

    12/20/2018, 10:06 PM
    I'm trying to load data in asynchronously (and with coroutines) from an API in a fragment. I want to show a loading screen and initiate data loading. When the data is loaded, I want to switch the fragment to showing the real view and immediately apply the data. How can I do something like this? As I understand it, view inflation (from XML) is asynchronous, so how would I make sure the real view is done inflating before trying to apply the data? Right now, I have it working without a loading screen, but that means using
    onViewCreated
    g
    k
    • 3
    • 2
  • k

    Kevin Janvier Chinabalire

    12/21/2018, 8:43 AM
    Hey guys i need your help here am working on rxjava 2 with Kotlin and the call is keep calling on error with - HTTP 400 Bad Request
    disposable!!.add(service.login(user)
                .subscribeOn(<http://Schedulers.io|Schedulers.io>())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe({ response ->
                    handleResponse(response)
    
                }, { error ->
                    Tools.log("Error ${error.message}")
                    handlerError(error)
                    register_progress!!.dismiss()
    
                })
            )
    My problem i keep gettting on error … even if the call is successful ….i get null
    g
    a
    • 3
    • 15
  • i

    igorvd

    12/21/2018, 2:30 PM
    I've notice a problem while using jacoco in a multi module kotlin project, the build fails when I'm using some
    inline
    function from my base module on other modules:
    Unable to instrument file with Jacoco... $inlined$extra$1.class
    I've found this: https://github.com/jacoco/jacoco/issues/688 and this: https://issuetracker.google.com/issues/109771903. Apparently, there is no fix for this problem at the moment. Someone knows a workaround?
    p
    i
    • 3
    • 3
  • l

    louiscad

    12/22/2018, 5:58 PM
    Hi all, do any Android developers here want to migrate their projects to Gradle Kotlin DSL, but struggled to do so? I migrated recently, with the help of a Kotlin script (to not do it too manually). I'm interested to see where you are struggling and happy to help. FYI, one of the benefits of Gradle Kotlin DSL is much improved IDE support with your favorite Kotlin features to reduce build scripts boilerplate.
    👍 2
    c
    t
    • 3
    • 4
  • k

    kenkyee

    12/22/2018, 10:49 PM
    Is it noticably slower? Saw the kotlinconf Gradle session and it sounded like it was 😔 We've got a significant number of groovy tasks as well so it's not a simple conversion...
    g
    • 2
    • 3
  • g

    ghedeon

    12/23/2018, 11:57 AM
    Does
    core-ktx
    spannable extension supports
    UrlSpan
    ? I see
    bold
    ,
    italic
    , etc.. How would you add a clickable url to that? (On a side note, if you want your custom view to accept styled text, what type would you choose?
    CharSequence
    ,
    Spanned
    ?)
    r
    • 2
    • 2
  • d

    dave08

    12/23/2018, 5:09 PM
    Coroutines
    Dispatchers.Main
    being run in an Android Service gives me the app's main ui thread, how do I run on the Service's thread? Passing the runBlocking's scope down? I really need it's handler...
    l
    • 2
    • 3
  • s

    Slackbot

    12/24/2018, 1:29 AM
    This message was deleted.
    o
    a
    • 3
    • 2
  • c

    cadi

    12/24/2018, 2:14 PM
    Hi everybody Is there a way to do something like this? am trying to have a generic viewModel in all my fragment
    r
    • 2
    • 3
  • a

    adams2

    12/26/2018, 4:17 PM
    I guess I can decompile my dex
    • 1
    • 1
  • h

    Hexa

    12/27/2018, 10:15 AM
    does anyone know if this is the right way to send protobuf message in the payload via Retrofit? https://stackoverflow.com/a/34639315
    a
    l
    • 3
    • 4
  • f

    fanie

    12/27/2018, 12:49 PM
    Question: How can one annotate properties in a Kotlin interface and handle them with an Annotation processor? What for? I am developing an Annotation and code generation based library for Android shared preferences. The idea is to decorate properties in an interface and generate the code needed to store and retrieve those properties to and from the SharedPreferences. Simply decorating does not seem to work; the processor can't find any of the target properties. The current workaround is using functions instead of properties. Properties would be so much better and technically sound though. The project is the following in case you want to have a look: https://github.com/iFanie/ConfigurNation
    l
    • 2
    • 4
  • r

    rakeeb

    12/28/2018, 7:10 PM
    has anyone tried using the
    IntRange
    annotation with Kotlin’s construction params? I can’t get the lint check to work. Is there an idiomatic way to this in Kotlin? Use-case:
    class Example(
      @param:IntRange(from = 1)
       val limit: Int = 1
    )
    g
    • 2
    • 2
  • s

    Slackbot

    12/30/2018, 8:46 AM
    This message was deleted.
    g
    u
    • 3
    • 2
  • a

    am414

    12/31/2018, 3:43 PM
    hi everyone 👋 I have a silly issue and I don't recognize what happens, actually, this is my first time to use a library written in Java for (android+kotlin) project I use this lib https://github.com/ittianyu/BottomNavigationViewEx
    BottomNavigationViewEx (latest version) + SdkVersion 28
    and I can't even declare the view to use it, I tried a few ways but always compiler error + runtime error so my question is that how I can declare this BottomNavigationViewEx View in my kotlin project
    val bottomNavigationViewEx = findViewById<BottomNavigationViewEx>(R.id.main_bottom_navigation)
    java.lang.RuntimeException: Unable to start activity ComponentInfo: java.lang.ClassCastException: com.google.android.material.bottomnavigation.BottomNavigationView cannot be cast to com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
    i
    r
    • 3
    • 5
Powered by Linen
Title
a

am414

12/31/2018, 3:43 PM
hi everyone 👋 I have a silly issue and I don't recognize what happens, actually, this is my first time to use a library written in Java for (android+kotlin) project I use this lib https://github.com/ittianyu/BottomNavigationViewEx
BottomNavigationViewEx (latest version) + SdkVersion 28
and I can't even declare the view to use it, I tried a few ways but always compiler error + runtime error so my question is that how I can declare this BottomNavigationViewEx View in my kotlin project
val bottomNavigationViewEx = findViewById<BottomNavigationViewEx>(R.id.main_bottom_navigation)
java.lang.RuntimeException: Unable to start activity ComponentInfo: java.lang.ClassCastException: com.google.android.material.bottomnavigation.BottomNavigationView cannot be cast to com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
i

itnoles

12/31/2018, 4:07 PM
You have to change it on XML layout too
a

am414

12/31/2018, 4:15 PM
@itnoles thanks for reply, sorry change the view to what ?
i

itnoles

12/31/2018, 4:17 PM
in XML, change com.google.android.material.bottomnavigation.BottomNavigationView to com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
🙏 1
a

am414

12/31/2018, 4:19 PM
oooooh 😂 many thanks bro, i didn't expect this
r

rnpy

01/02/2019, 8:58 PM
I'd recommend against using that lib, it's a pretty ugly hack that uses reflection to modify the support library bottom bar control
View count: 5