I am new in using Android Studio. I used this because our professor wants us to make an application. I am following the tutorial on YouTube step by step and I know that I did everything he did on the video. But why am i having this error Unresolved reference: nextActivity?
Here is the code in MainActivity.kt
package com.willitpush.app
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
nextActivity.setOnClickListener{
}
}
}
Here is the code on activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
tools:context=".MainActivity">
<Button
android:id="@+id/nextActivity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="#2196F3"
android:text="play"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
As you can see there should be no error because I typed in the same id. but why am I having error on this line? nextActivity.setOnClickListener. Sorry I am just new in Android Studio.
plugin: 'kotlin-android-extensions'