Home > Blockchain >  String not recognised in intent.putExtra Unexpected tokens error
String not recognised in intent.putExtra Unexpected tokens error

Time:02-13

enter image description here

fun createBirthdayCard(view: View) {

     val name = nameInput.editableText.toString()

     val intent = Intent(this, BirthdayGreeting::class.java)
        intent.putExtra(name:"name", name)
     startActivity(intent)
 }

}

CodePudding user response:

remove name: you don't need to mention it . just write like this

   intent.putExtra("name", name)

CodePudding user response:

remove name: from putExtra i.e

val intent = Intent(this, BirthdayGreeting::class.java)
intent.putExtra("name", name)
startActivity(intent)
  • Related