Skip to content

Instantly share code, notes, and snippets.

@sakurabird
Created October 10, 2013 18:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sakurabird/6923317 to your computer and use it in GitHub Desktop.
Save sakurabird/6923317 to your computer and use it in GitHub Desktop.
(Android)Intentでメールアプリを呼び出す。セキュリティ上好ましい方法
public void onClick1(View view) {
// logcatにメールアドレスが表示される呼び出し方。セキュリティ上好ましくない
Uri uri = Uri.parse("mailto:" + mail);
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
startActivity(intent);
}
public void onClick2(View view) {
// logcatにメールアドレスが表示されない呼び出し方。セキュリティ上好ましい
Uri uri = Uri.parse("mailto:");
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
intent.putExtra(Intent.EXTRA_EMAIL,
new String[] {
mail
});
startActivity(intent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment