Isa*_*cox 0 android android-intent
我的代码是这样的:
Intent i = new Intent(Intent.ACTION_SENDTO);
i.putExtra(Intent.EXTRA_EMAIL,"example @example. Com");
i.putExtra(Intent.EXTRA_SUBJECT,"Grannylaunch Support Needed:" + System.currentTimeMillis());
startActivity(i);
Toast.makeText(getApplicationContext(),"Emailing Support....", Toast.LENGTH_LONG);
Run Code Online (Sandbox Code Playgroud)
我的问题是意图不是开始活动.我做错了什么,我该如何解决?
我尝试过设置intent = Intent.ActionSend,但是没有用.
编辑 -
Intent i = new Intent(Intent.ACTION_SENDTO);
i.putExtra(Intent.EXTRA_EMAIL,"example@example.com");
i.putExtra(Intent.EXTRA_SUBJECT,"Grannylaunch Support Needed:" + System.currentTimeMillis());
i.putExtra(Intent.EXTRA_TEXT,"");
startActivity(i);
Toast.makeText(getApplicationContext(),"Emailing Support....", Toast.LENGTH_LONG);
Run Code Online (Sandbox Code Playgroud)
这也不起作用.
protected void sendEmail() {
Log.i("Send email", "");
String[] TO = {"amrood.admin@gmail.com"};
String[] CC = {"mcmohd@gmail.com"};
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setData(Uri.parse("mailto:"));
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_EMAIL, TO);
emailIntent.putExtra(Intent.EXTRA_CC, CC);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Your subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Email message goes here");
try {
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
finish();
Log.i("Finished sending email...", "");
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(MainActivity.this,
"There is no email client installed.", Toast.LENGTH_SHORT).show();
}
Run Code Online (Sandbox Code Playgroud)
试试这可能会帮助你
| 归档时间: |
|
| 查看次数: |
809 次 |
| 最近记录: |