package jackall.moncalc.viewmodel import android.databinding.BindingAdapter import android.databinding.ObservableField import android.view.View import kotlin.concurrent.thread /** * Created by matsumoto_k on 2017/11/05. */ class TestViewModel { var hogehoge = ObservableField<String>("aaa") init { thread { try { Thread.sleep(1000) } catch (e: Exception) { } hogehoge.set("bbb") try { Thread.sleep(1000) } catch (e: Exception) { } hogehoge.set("ccc") try { Thread.sleep(1000) } catch (e: Exception) { } hogehoge.set("eee") try { Thread.sleep(1000) } catch (e: Exception) { } hogehoge.set("fff") } } object Adapter { @JvmStatic @BindingAdapter("android:hogehoge") fun hoge(view: View, hogehoge: String) { println(hogehoge) } } }