ClickEvent for SubItems
SamFreaks opened this issue · 0 comments
SamFreaks commented
Hey,its not an Bug or an Issue,
I implement this in my Project and i try to use it with 3 Subbottons (Email, Homepage, Telegram-Group) and i use
val fab = findViewById(R.id.fab) fab.addOnMenuItemClickListener { _, _, _ -> val to = "xxx" val
subject
= "xxx" val message = "xxxx"```
val email = Intent(Intent.ACTION_SEND)
email.putExtra(Intent.EXTRA_EMAIL, arrayOf(to))
email.putExtra(Intent.EXTRA_SUBJECT, subject)
email.putExtra(Intent.EXTRA_TEXT, message)
email.type = "text/email"
startActivity(Intent.createChooser(email, "Choose an Email client :")) }
}
it works on every subbutton click, but if i type in fab_email ( thats the id in my menu->fab.xml)
android:id="@+id/fab_email"
android:title="Email"
android:icon="@android:drawable/ic_dialog_email"
android:orderInCategory="1"/>
my app crash
val fab = findViewById(R.id.fab_email) fab.addOnMenuItemClickListener { _, _, _ -> val to = "xxx" val
subject = "xxx" val message = "xxxx"```
val email = Intent(Intent.ACTION_SEND)
email.putExtra(Intent.EXTRA_EMAIL, arrayOf(to))
email.putExtra(Intent.EXTRA_SUBJECT, subject)
email.putExtra(Intent.EXTRA_TEXT, message)
email.type = "text/email"
startActivity(Intent.createChooser(email, "Choose an Email client :")) }
}
hope you can help me and sry for my bad english