Skip to content
Snippets Groups Projects

Text Change

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    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'

    java 442 B
    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() }
                }
    0% or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment