kobakei / MaterialFabSpeedDial

Android UI library of FAB speed dial
Apache License 2.0
190 stars 27 forks source link

ClickEvent for SubItems #30

Open SamFreaks opened 5 years ago

SamFreaks commented 5 years ago

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