Text Change
The snippet can be accessed without any authentication.
Authored by
Rubick - Yatno Sudar
implement dulu library => implementation 'com.jakewharton.rxbinding3:rxbinding:3.0.0-alpha2'
edt.textChanges()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.filter { it.isNotEmpty() }
.map { t -> t.toString().toInt() }
.filter { it -> (it % 2 == 0) }
.map { it -> it.toString() }
.subscribe { it ->
runOnUiThread { Toast.makeText(this, it[it.lastIndex].toString(), Toast.LENGTH_SHORT).show() }
}
Please register or sign in to comment