这是代码,除了没有应用程序可以执行此操作“错误之外,一切正常。请让我知道代码中的错误是什么。
public void sends(View button) {
// Do click handling here
final EditText date = (EditText) findViewById(R.id.editText1);
String da = date.getText().toString();
final EditText phone = (EditText) findViewById(R.id.editText2);
String ph = phone.getText().toString();
final EditText nameplate = (EditText) findViewById(R.id.editText3);
String np = nameplate.getText().toString();
final EditText issue = (EditText) findViewById(R.id.editText4);
String i = issue.getText().toString();
StringBuilder s= new StringBuilder(100);
s.append(da);
s.append(". ");
s.append(ph);
s.append(". ");
s.append(np);
s.append(". ");
s.append(i);
String st=s.toString();
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
//emailIntent.setType("plain/text");
//startActivity(emailIntent);
startActivity(Intent.createChooser(emailIntent, "Send your email in:"));
Intent emailIntentt= new Intent(android.content.Intent.ACTION_SEND);
String aEmailList[] = { "shreyas.tallani@gmail.com" };
emailIntentt.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);
//emailIntentt.putExtra(android.content.Intent.EXTRA_CC, aEmailCCList);
//emailIntentt.putExtra(android.content.Intent.EXTRA_BCC, aEmailBCCList);
emailIntentt.putExtra(android.content.Intent.EXTRA_SUBJECT, "Feedback");
emailIntentt.setType("message/rfc822");
emailIntentt.putExtra(android.content.Intent.EXTRA_TEXT, st);
startActivityForResult(emailIntentt, REQUEST_SEND_MAIL);
}
public static final int REQUEST_SEND_MAIL = 1;
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case REQUEST_SEND_MAIL:
// When the request to send mail returns
if (resultCode == Activity.RESULT_OK) {
Toast.makeText(this, "message successfully sent", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "sorry", Toast.LENGTH_SHORT).show();
}
}}