unresolved reference
val name = nameInput.editableText.toString() // getting error in this line
val intent = Intent (this, BirthdayGreetingsActivity::class.java)
startActivity(intent)
CodePudding user response:
Try this
in your XML, you will have a view like
<EditText
android:id="@ id/nameInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:ems="10"
android:inputType="textPersonName"
android:minHeight="48dp"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@ id/textView" />
in your activity class add this
val name : EditText = findViewById(R.id.nameInput)
and get the input text with
name.text.toString()