Yes its late - but may help someone on reference
xml with EditText, Button and TextView
onClick on Button will update the value from EditText to TextView
<EditText
android:id="@+id/et_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/btn_submit_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/txt_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
Look at the code do the action in your class
Don't need to initialize the id's of components like in Java. You can do it by their xml Id's
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_sample)
btn_submit_id.setOnClickListener {
txt_id.setText(et_id.text);
}
}
also you can set value in TextView like,
textview.text = "your value"