Find the ID

Report a typo

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center_vertical">
    
    <Button
        android:id="@+id/nextActivityButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="next activity"
        android:layout_gravity="center_horizontal" />
</LinearLayout>

Given the XML layout above, how would you make a reference to the ID of the declared Button in your Kotlin code?

Enter a short text
___

Create a free account to access the full topic