Skip to content

Instantly share code, notes, and snippets.

@vamsitallapudi
Last active March 4, 2019 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vamsitallapudi/379fc1d2e108fc23ed38f6596777c9cf to your computer and use it in GitHub Desktop.
Save vamsitallapudi/379fc1d2e108fc23ed38f6596777c9cf to your computer and use it in GitHub Desktop.
package com.coderefer.rxandroidexamples.intro.operators.transform
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.util.Log
import com.coderefer.rxandroidexamples.R
import io.reactivex.Observable
import io.reactivex.disposables.Disposable
private const val TAG = "BufferOperator"
class BufferOperatorActivity : AppCompatActivity() {
private lateinit var disposable: Disposable
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_buffer)
val observable =
Observable.just(10, 20, 30, 40, 50, 60)
.buffer(3)
disposable = observable.subscribe {
Log.d(TAG, "onNext: ")
for(s in it) {
Log.d(TAG, s.toString())
}
}
}
override fun onDestroy() {
disposable.dispose()
super.onDestroy()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment