我正在尝试按下一个按钮,当点击该按钮时会打开一个可以发送电子邮件的电子邮件窗口。我收到以下错误:
不支持的操作 - 目前不支持该操作
这是我的代码。
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN)
{
Intent displayIntent = new Intent(android.content.Intent.ACTION_SEND);
displayIntent.setType("text/plain");
displayIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"to@email.com"});
displayIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
displayIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Text");
_this.startActivity(Intent.createChooser(displayIntent, "Send Email"));
}
return true;
}
});
答案 0 :(得分:3)
更改
_this.startActivity(Intent.createChooser(displayIntent, "Send Email"));
到
_this.startActivity(displayIntent);