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

    dave08

    09/15/2017, 6:53 AM
    How do you use rx with coroutines? All libs are proof of concept for now,...?
    b
    • 2
    • 28
  • r

    rwachol

    09/20/2017, 2:53 PM
    The best presentation about Rx I’ve seen was in Polish…
    😀 1
    k
    • 2
    • 3
  • c

    cdurham

    09/27/2017, 3:43 PM
    @adams2 i would expect unsubscribing a connected observable would disconnect but i havent tested that at all
    a
    • 2
    • 1
  • p

    Pierrick

    09/28/2017, 10:11 AM
    Hello everyone, I'm using RxSwift in my iOS app and now I want to use RxKotlin in my Android app, but one question, with RxSwift you can create a
    Variable
    to access to the current value (
    myVar.value
    ) and if you want you can create an observable (
    myVar.toObservable
    ). There is a way to do that with RxKotlin ?
    g
    e
    • 3
    • 6
  • d

    dimsuz

    09/28/2017, 12:38 PM
    I mean if observable1 emitted an item, then received another and is in a delay stage, and at this point observable2 click hits => using
    withLatestFrom
    would pick a previous item from observable1 which is not what needed
    c
    • 2
    • 7
  • a

    adams2

    09/30/2017, 2:16 PM
    I discovered this - https://github.com/JakeWharton/RxReplayingShare. Seems like it works better than connectable observables for my usecase (see snippet), without actually using connectableobservable
    • 1
    • 1
  • a

    anstaendig

    10/16/2017, 6:41 AM
    What’s the reason for Wrapping an Observable in another Observable?
    f
    e
    d
    • 4
    • 8
  • g

    gabrielfv

    10/21/2017, 5:26 PM
    I want to get all bytes and merge them together on a ByteArray. All the bytes are organized in such way: The first, m bytes that can be computed to fetch the amount of remaining n bytes
    e
    • 2
    • 2
  • f

    fstn

    10/21/2017, 7:27 PM
    Hi guys, I don’t know what I doing wrong but my next is never call inside the subscribe
    rx.Observable.merge(
            events.map{
                   eventbus.rxSend(....).toObservalbe()
           }
    }.subscribe(next,error)
    e
    • 2
    • 23
  • s

    Slackbot

    10/22/2017, 1:28 PM
    This message was deleted.
    🙄 1
    f
    e
    • 3
    • 3
  • v

    viliusk

    11/15/2017, 1:24 PM
    Guys, how would you recommend handling errors on :android: when my scenario is: • subscribe to text changes from search field (with
    RxTextView.textChanges(customer_phone_number)
    ) • debounce queries (every 1second) • show progressBar • execute retrofit call:
    apiServices.getMemberDetails(it)
    • show membership details on success with
    showMemberDetails(it.membership)
    • keep waiting for query updates if nothing was found and HttpException: HTTP 400 happened. When HTTP failure happens, my subscription to query updates is lost. What’s correct approach for such scenario?
    • 1
    • 1
  • a

    alex.hart

    11/15/2017, 2:05 PM
    Think of the different shapes your network response can take, and then map each shape to a member of a sealed class. For example:
    sealed class Response {
        data class Success(data: Data): Response()
        data class Error(code: Int, msg: String): Response()
    }
    Then, when you perform your retrofit action, you can map whatever happens to the appropriate response. The trick is to make sure an error never really enters the stream to begin with (as I believe it gets trickier since as soon as you send an error your original stream is going to terminate)
    👍 1
    v
    • 2
    • 2
  • l

    leosan

    11/15/2017, 2:11 PM
    @viliusk you can compose your stream to deal with the networking error as @alex.hart suggested but you shouldn't be finishing your upstream on networking error basically because what you want keep listening to your stream until your view is destroyed
    v
    a
    • 3
    • 14
  • k

    kevin.cianfarini

    11/23/2017, 10:52 PM
    So I'm kind of new to Rx. Can someone go in depth on the differences between
    subscribeOn
    and
    observeOn
    ? From what I understand subscribeOn defines where the data is originally emitted from and each subsequent observeOn sends those emissions to different threads?
    e
    • 2
    • 2
  • a

    anstaendig

    11/24/2017, 1:38 PM
    As in the first one “wins”
    t
    e
    • 3
    • 5
  • t

    thomasnield

    11/24/2017, 2:01 PM
    My book "Learning RxJava" is on sale for $10. Happy Black Friday everyone. https://www.packtpub.com/application-development/learning-rxjava
    👍 2
    s
    • 2
    • 1
  • r

    ramonsgds

    12/12/2017, 2:47 AM
    But even then, the logout works if I don’t go to CheckInClientActivity but if I go there and return to the home activity where the logout button resides, then the logout doesn’t work (nothing happens really.. as if there was no action to confirming logout through the dialog)
    g
    • 2
    • 22
  • r

    ramonsgds

    12/12/2017, 2:48 AM
    Regarding your question, I’ll take a look into these then, but I saw on a medium tutorial the guy inserting/deleting using
    Single.fromCallable
    and then I sticked up with it
    g
    • 2
    • 1
  • j

    jw

    12/21/2017, 10:15 PM
    only the steps after parallel will be parallelized
  • m

    myanmarking

    12/22/2017, 9:58 AM
    guys whats the best way to start a flowable after a single completes?
    g
    • 2
    • 1
  • k

    katien

    12/30/2017, 11:30 PM
    Hey guys, do how did you all get started with RxJava/RxKotlin? I'm relatively new to the whole thing and sometimes have trouble wrapping my head around what's going on. I've got a pretty JS heavy background and found that reading the RxJS docs was actually pretty helpful for understanding overarching concepts, but I'm working on a Kotlin Android project. The RxJava documentation is a bit confusing to me so I'm hoping for something more like a guide or tutorial.
    e
    t
    • 3
    • 8
  • d

    dimsuz

    01/01/2018, 6:35 PM
    Hi! I have a bunch of `Maybe`'s and I'd like to log when some of them complete without emitting an item. Is this possible somehow? I need a variant of
    doOnComplete()
    which is invoked only when Maybe is empty...
    t
    • 2
    • 4
  • k

    katien

    01/02/2018, 3:30 AM
    Is there a way to transform an error before onError() is called on my observer? I'm imagining something like
    map
    , but where
    map
    will transform a success result before
    onComplete(successResult)
    is called, this function would transform an error before
    onError(error)
    is called
    g
    • 2
    • 3
  • m

    mingkangpan

    01/31/2018, 12:10 PM
    I thought per default you observe on the Thread where you subscribe, but does the first function work, if the second doesn't?
    m
    j
    • 3
    • 11
  • r

    rakeeb

    02/05/2018, 9:00 AM
    https://twitter.com/RakeebJH11/status/960408544318312448
    e
    a
    r
    • 4
    • 18
  • r

    rakeeb

    02/06/2018, 7:24 AM
    https://twitter.com/RakeebJH11/status/960771857279606784
    • 1
    • 1
  • k

    katien

    02/07/2018, 1:49 AM
    if I add import io.reactivex.functions.Function3 explicitly the error goes away
    g
    • 2
    • 1
  • s

    sanogueralorenzo

    02/07/2018, 12:59 PM
    I did a sample project here, https://github.com/sanogueralorenzo/TestConcatIssue/blob/master/app/src/main/java/com/sanogueralorenzo/testconcatissue/MainActivity.kt even if you use Single.just for the first one you are still able to reproduce the issue sometimes opening the app in airplane mode
    m
    • 2
    • 11
  • r

    rakeeb

    02/08/2018, 9:23 AM
    https://twitter.com/RakeebJH11/status/961529366286077952
    m
    • 2
    • 3
  • h

    hmole

    02/08/2018, 4:44 PM
    Does anyone know library/extension that wraps okhttp3 into Observable/Single? I need specifically okhttp3, not Retrofit.
    m
    d
    d
    • 4
    • 4
Powered by Linen
Title
h

hmole

02/08/2018, 4:44 PM
Does anyone know library/extension that wraps okhttp3 into Observable/Single? I need specifically okhttp3, not Retrofit.
m

maciekjanusz

02/08/2018, 5:27 PM
probably there isn’t, but it’s really easy to do it yourself, like this
val call: Call
Observable.fromPublisher<Response> { s ->
    call.enqueue(object : Callback {
        override fun onFailure(call: Call?, e: IOException?) = {
            s.onError(e)
        }
        override fun onResponse(call: Call?, response: Response?) = {
            s.onNext(response)
            s.onComplete()
        }

    })
}
d

dkhusainov

02/08/2018, 8:47 PM
But it doesn't cancel the call on .dispose()
d

damien5314

02/09/2018, 12:28 AM
check the source code for retrofit, it should be doing exactly what you're looking for
can just emulate their strategy
View count: 2