2011-12-20 34 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