I am using the following code in my function such that it's a part of an Rxjava code where I subscribe. Is there a way I can convert this code to a lambda expression?
object : Mysubscriber<MyEntry>() {
var result: MYEntry? = null
override fun onComplete() {
result?.let {
val something = Something(title = it.getField<String>(MyConstants.TITLE_KEY),
somethingImageAsset = it.getField<MyAsset>(MyConstants.IMAGE_KEY),
bodyText = it.getField<String>(MyConstants.BODY_TEXT_KEY))
view?.updateMySpace(something)
}
}
override fun onError(e: Throwable) {
Timber.e(e)
}
override fun onNext(entry: MyEntry) {
result = entry
}
}
Just FYI, the RXjava function for the above code is :
myvar.observe(MyEntry::class.java)
.one(entryId)
.applySchedulers()
.applyOpBeforeAfter(showProgress, hideProgress)
.subscribe(
"above code" )
Any ideas how to easily convert it to lambda expression?
Thanks!