0

我创建了一个表单应用程序,用户填写表单然后单击提交按钮,该按钮在电子邮件中格式化用户数据。该应用程序在我的 Droid Charge 上填充电子邮件正文中的数据,但当有人使用 Galaxy S 时,电子邮件正文为空白。有谁知道解决此问题的方法?

Intent emailIntent = new Intent(
                    android.content.Intent.ACTION_SEND);
            emailIntent.setType("message/rfc822");
            emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
                    new String[] { "email@email.com" });
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
                    "Form on " + String.valueOf(editText1.getText()) + "Tech " + String.valueOf(editText2.getText()));
            emailIntent.putExtra(
                    android.content.Intent.EXTRA_TEXT,
                    "Completed by = " + String.valueOf(editText1.getText())
                            + " / " + String.valueOf(editText2.getText())
                            + '\n' + "Tech Center = "
                            + String.valueOf(editText3.getText())
                            + '\n' + "Job # = "
                            + String.valueOf(editText4.getText())
                            + '\n' + "Date = "
                            + String.valueOf(editText5.getText())
                            + '\n' + "Address = "
                            + String.valueOf(editText6.getText())
                            + '\n' + "Type = "
                            + String.valueOf(spinner7.getSelectedItem())
                            + '\n' + "Work = "
                            + String.valueOf(spinner8.getSelectedItem())
                            + '\n' + "Location = "
                            + String.valueOf(spinner9.getSelectedItem())

                            //code omitted

                            + '\n' + "Referrals = "
                            + String.valueOf(editText8.getText())
                            + '\n' + String.valueOf(result11.toString()));

            startActivity(Intent.createChooser(emailIntent, "Send Mail"));
            finish();

        }

    });

}
4

1 回答 1

0

请尝试改用该Intent.ACTION_SENDTO操作。这还有一个额外的好处,就是只有实际的电子邮件应用程序出现在选择器中。

不幸的是,我认为您在使用Intent.ACTION_SENDTO. 你必须使用这样的东西:

Intent emailIntent = new Intent(Intent.ACTION_SENDTO).setData(Uri.parse(String.format(
   "mailto:%s?subject=%s&body=%s",
   recipient,
   subject,
   body
).replace(" ", "%20")));
于 2012-09-28T08:43:51.253 回答