是否可以制作电子邮件应用的imageview链接?就像当你点击它时,电子邮件应用程序将打开一个特定的电子邮件地址发送?
答案 0 :(得分:1)
findViewById(R.id.imageview).setOnClickListener(new OnClickListener() {
public void onClick(View _) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.fromParts("mailto","abc@gmail.com", null));
startActivity(i);
}
}
答案 1 :(得分:1)
img.setOnClickListener(
new OnClickListener(View v) {
String yourMail = "mail@example.com";
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("message/rfc822");
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{yourMail});
intent.putExtra(Intent.EXTRA_SUBJECT, "Your subject");
intent.putExtra(Intent.EXTRA_TEXT, "Your content");
try {
startActivity(intent, "Pick an email application...");
} catch(Exception e) {
Toast.makeText(YourMainActivity.this, "Have no email application!", Toast.LENGTH_SHORT).show();
}
}
);