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

    jw

    09/05/2018, 7:46 PM
    @alex.krupa send a PR
    a
    • 2
    • 2
  • u

    ubu

    09/07/2018, 2:41 PM
    An example:
    override fun onSatelliteClicked() {
            mapSubject.take(1).subscribe(this::toggleSatelliteMode)
        }
    k
    • 2
    • 6
  • e

    elizarov

    09/11/2018, 6:00 PM
    @Janez Štupar
    ktor
    is based on Kotlin coroutines. Instead of
    readable.subscrible
    you should do
    readable.consumeEach
    (add
    kotlinx-coroutines-rx1/2
    to your dependencies).
    j
    • 2
    • 1
  • u

    ursus

    09/13/2018, 6:15 AM
    Isnt there some stuff about writes needing to be sequential? Id swear there were some exceptions about database being locked etc.
    u
    • 2
    • 1
  • u

    ursus

    09/20/2018, 4:56 PM
    depends on what combining logic you need, and 90% of time you one just one emit, so you need take 1, and then its the same
    r
    • 2
    • 2
  • k

    Kotlin

    09/28/2018, 10:38 AM
    Hi All, I am new to Rx world and stuck into implementing polling mechanism in RxJava2 for Android. I have to call a webservice max x times and at the interval of y seconds on the success or failure of that webservice. By interval I mean wait for y seconds before making another call. For network call call back mechanism is being used.I also need to show UI based on servive response.Can someone here can help me in implementing the same? It would be highly appreciated.
    c
    j
    u
    • 4
    • 7
  • u

    ursus

    09/29/2018, 5:12 PM
    also probably there should be locks around the init? because I do expose the SyncManager to app where you can call sync, so callsite can probably call init() again and fck the thing up
    e
    • 2
    • 1
  • k

    kenkyee

    10/02/2018, 11:08 AM
    Flatmap
    k
    • 2
    • 1
  • s

    Suhit Patil

    10/03/2018, 3:52 PM
    @kenkyee Rx concepts are same on every platform plus kotlin syntax is similar to swift.
    👎 3
    🙄 3
    a
    e
    • 3
    • 4
  • l

    locke

    10/04/2018, 8:30 PM
    Is there a canonical way to subscribe to `Observable`s across
    Fragment
    boundaries?
    u
    j
    • 3
    • 2
  • t

    thomasnield

    10/14/2018, 12:52 PM
    My book Learning RxJava is free today. Grab it while you can! https://www.packtpub.com/packt/offers/free-learning
    👍 1
    k
    • 2
    • 4
  • r

    robinchew

    10/17/2018, 2:03 PM
    Hey there, how can I use
    scan
    where the accumulation function has 2 arguments of different types?
    l
    u
    • 3
    • 2
  • a

    Alan Lee

    10/18/2018, 10:12 PM
    I’m trying to do below referencing the following article: https://blog.danlew.net/2015/03/02/dont-break-the-chain/
    fun <T> applySchedulers(): FlowableTransformer<T, T> {
            return FlowableTransformer {
                it.observeOn(mainScheduler).subscribeOn(computationScheduler)
            }
        }
    I’m try to operate on ‘BehaviorProcessor<List<XXX>>’.
    behaviorProcessor.compose(applySchedulers())
    works but trying to assign the result to Flowable<List<XXX>> causes an error.
    Type Inference failed. Expected Type mismatch.
    required: Flowable<List<XXX>>, found: Flowable<List<XXX>!>!
    How do I resolve the type inference error?
    • 1
    • 1
  • u

    ursus

    10/19/2018, 1:48 PM
    yes but you need to pass the progress as parameter
    n
    • 2
    • 3
  • j

    jw

    10/23/2018, 3:57 AM
    i recommend not using viewmodels (the library), but for the general concept of view models you should be posting back to the main thread before they are cached
    g
    • 2
    • 11
  • u

    ursus

    10/25/2018, 9:31 PM
    and you need that keep track of that boolean to know if you are in pip mode state
    g
    • 2
    • 15
  • u

    ursus

    11/07/2018, 5:55 PM
    can someone help me refactoring this to
    using
    ?
    contentObservable(resolver, uri, handler)
                    .flatMapSingle {
                        Single.fromCallable { resolver.query(uri, projection, selection, selectionArgs, sortOrder) }
                    }
                    .map<Optional<Contact>> { optionalOf(mapContact(it)) }
    where that fromCallable returns Single<Cursor>, so obviously it will not close the cursor if stream gets unsubscribed after that and before mapContact where I actually close the cursor (now), therefore leaking the cursor right?
    a
    • 2
    • 42
  • u

    ursus

    11/07/2018, 6:05 PM
    -- anyone has a clue about
    using
    usage?
    a
    • 2
    • 1
  • t

    trent

    11/11/2018, 3:06 AM
    Anyone still using RxJava 1 for some reason?
    g
    • 2
    • 4
  • t

    trent

    11/11/2018, 3:08 AM
    Also how stable is RxKotlin & how wide spread is it?
    g
    u
    a
    • 4
    • 18
  • u

    ursus

    11/12/2018, 5:53 PM
    why not? isnt that what viewmodels do?
    class ViewModel {
       private val relay = BehaviourRelay.create()
       val observable get() = relay
    
       init {
         repository.
            .operators...
            .subscribe(relay)
       }
    }
    
    class Activity {
       onCreate {
          viewModel
             .observable
             .subscribe { }
       }
    }
    a
    • 2
    • 1
  • u

    ursus

    11/13/2018, 2:39 AM
    btw how do you make viewmodel´s observable not disposed between config changes without relays, only via replayed hot observable?
    refCount
    would dispose it after first UI onDestroy, since its the only subscriber
    a
    • 2
    • 11
  • u

    ursus

    11/13/2018, 4:29 AM
    I wanna ask about thread safety in rxjava, where do I need to add it manually? I have a hunch that subscribers, i.e. the onNext lambdas are not, right?
    g
    k
    • 3
    • 21
  • u

    ursus

    11/13/2018, 7:17 PM
    -- if I create scheduler via
    Schedulers.from(Executors.newSingleThreadExecutor { Thread(it, "SipCallManagerThread") })
    , do I need to shutdown it explicitly like a native resource or is leaving it to be GCed okay?
    a
    • 2
    • 2
  • u

    ursus

    11/14/2018, 1:13 AM
    Is there a
    switchMap
    which will guarantee atleast one emission of the mapped observable? Or rather
    concatMap
    that will take 1 || takeUntil new upstream emit?
    a
    • 2
    • 4
  • s

    Sudhir Singh Khanger

    12/03/2018, 10:15 AM
    I am new to Rx. I have to POST total Y number of items in a batches of X items at a time via retrofit. Which Observable, operator, etc. should I be using? I want Rx to send X items at a time until total Y number of items have been sent.
    g
    g
    u
    • 4
    • 17
  • u

    ursus

    12/04/2018, 4:39 AM
    Whos responsibility should it be? Lets say ForegroundGpsProvider, and it would expose that switchMap as a foregroundCurrentPositionObservable. Good. Now however I want to run a sync, sync is not rx api, so we need to subscribe and do it there
    a
    • 2
    • 2
  • s

    Slackbot

    12/06/2018, 10:56 PM
    This message was deleted.
    g
    u
    • 3
    • 3
  • u

    ursus

    12/14/2018, 5:28 AM
    Is there a solution to diamond problem in combineLatest in rxjava? (when source observables of the combineLatest are driven by common observable -- you get unexpected results since first source will emit first, therefore paired with previous value of second source)
    r
    a
    • 3
    • 5
  • c

    Clive

    12/17/2018, 8:37 PM
    is there anything like rx’s .buffer() for kotlin’s sequence / iterable?
    g
    g
    • 3
    • 4
Powered by Linen
Title
c

Clive

12/17/2018, 8:37 PM
is there anything like rx’s .buffer() for kotlin’s sequence / iterable?
g

gildor

12/17/2018, 11:34 PM
But sequence and iterable are completely syncronous, they are pull based, not push based as rx How do you expect this should work? You can use take(N) to get required amount of items, it's closest what I can imagine to buffer (but pretty different)
g

gsala

12/18/2018, 8:32 AM
You can use
.chunked(n)
if what you want is to group into lists of
n
items
👍 1
c

Clive

12/18/2018, 3:39 PM
^ exactly what i was looking for. thanks!
^ and the terminology makes sense too since it’s synchronous
View count: 4