How to pass the values from activity to another activity in kotlin

前端 未结 7 877
北恋
北恋 2020-12-03 10:13

As I\'m learning Kotlin for Android development, I\'m now trying the basic programs like hello world and how to navigate from one activity to another activity , there is no

7条回答
  •  旧巷少年郎
    2020-12-03 11:12

    You can simply use the intents and bundle to send data from one activity to another activity.

    val intent = Intent(this@OneActivity,TwoActivity::class.java);
    intent.putExtra("username", userName)
    startActivity(intent);
    

提交回复
热议问题