How to fix your problem
In general, I think we should do these as below.
- Check the log in the Logcat panel in Android Studio, maybe there are exceptions.
- Added your debug code where you want to add.
CodePudding user response:
val i = Intent(Intent.ACTION_SEND)
i.type = "message/rfc822"
i.putExtra(Intent.EXTRA_EMAIL, arrayOf<String>("[email protected]"))
i.putExtra(Intent.EXTRA_SUBJECT, "Feedback")
i.putExtra(Intent.EXTRA_TEXT, "Text here...")
try {
startActivity(Intent.createChooser(i, "Send mail..."))
} catch (ex: ActivityNotFoundException) {
Toast.makeText(this, "There are no email clients installed.", Toast.LENGTH_SHORT)
.show()
}