Android 如何传递值

Android 如何传递值,android,kotlin,rx-kotlin,Android,Kotlin,Rx Kotlin,如何从此代码中获取值时间 val TAG = MainActivity::class.java.name TrueTimeRx.build() .initializeRx("time.google.com") .subscribeOn(Schedulers.io()) .subscribe({ time -> Log.v(TAG, "TrueTime was initialized and we have a time: $time") },

如何从此代码中获取值
时间

val TAG = MainActivity::class.java.name
TrueTimeRx.build()

    .initializeRx("time.google.com")

    .subscribeOn(Schedulers.io())

    .subscribe({ time ->
        Log.v(TAG, "TrueTime was initialized and we have a time: $time") },
        { throwable -> throwable.printStackTrace() }

    )
把它放在这个代码里

helloWorld=findViewById(R.id.helloWorld)

val newTime=getString(R.string.hello, time)
helloWorld.text=newTime
如何从代码的第一部分提取时间并将其放入第二部分

上面的代码位于
onCreate()中

如果重要的话,我有这个

internal lateinit var helloWorld: TextView

该值将在用户块中可用:

TrueTimeRx.build()
    .initializeRx("time.google.com")
    .subscribeOn(Schedulers.io())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe({ time ->
      Log.v(TAG, "TrueTime was initialized and we have a time: $time")
      val newTime = getString(R.string.hello, time)
      helloWorld.text = newTime
    }, { throwable -> throwable.printStackTrace() }
    )
请注意,您必须
observeOn(AndroidSchedulers.mainThread())
才能修改块内的视图内容