2011-12-20 37 views
0

我得到了这个Bug列表活动来报告我的应用程序中的错误。有EditText和按钮。我希望按钮通过EditText中的文本向我发送电子邮件。我使用了一些教程以及与此想出了:自动发送邮件

 private void sendEmail() { 
      final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
      emailIntent.setType("text/plain"); 
      emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, "[email protected]"); 
      emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "CFM - zgłoszenie"); 
      emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, description.getText()); 
      BugList.this.startActivity(Intent.createChooser(emailIntent, "Send mail...")); 
     } 

但是它只是打开空白ADDRES和主题字段emmail应用。我希望他们像上面那样被填补。

+2

变化 “text/plain的” 到 “纯/文本”。我是不知道它。但是给一个尝试 – Sameer 2011-12-20 11:22:10

回答

2

emailIntent.setType(“plain/text”); 和 的String [] { “[email protected]”}

 private void sendEmail() { 
     final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
     emailIntent.setType("plain/text"); 
     emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, String[]{"[email protected]"}); 
     emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "CFM - zgłoszenie"); 
     emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, description.getText()); 
     BugList.this.startActivity(Intent.createChooser(emailIntent, "Send mail...")); 
    } 
+0

OK,subjest是现在填补了,但最重要的电子邮件地址仍然是空白的。然而,我正在运行MIUI和使用谷歌电子邮件应用程序,不知道如果它可能与这个 – 2011-12-20 11:28:52

+0

我想iot可能是这样的:new String [] {“[email protected]”} - 尝试现在 – 2011-12-20 11:30:07