android - Using RxJava with Handler reset Message.what value -
rxjava 1.1.8
the idea listen handler messages subscriptions message.what
attribute comes 0 always.
class rxhandler(looper: looper) : handler(looper) { val messagesobservable = publishsubject<message>() override fun handlemessage(msg: message?) { super.handlemessage(msg) msg?.let { messagesobservable.onnext(it) } } }
and subscribe it:
playbackhandler.messagesobservable .subscribe({ // it.what 0 }, { timber.e(it, "error on playback handler message handling") })
and then:
playbackhandler.sendemptymessage(1)
then message.what == 0
expected: message.what == 1
Comments
Post a Comment