インテント(Intent)を利用することで, メール作成画面を呼び出して表示することができる.
メールの呼出
IntentMail01.java
インテントのインスタンスを生成する.
Intent#setActionメソッドを使って, アクションにACTION_SENDTOを設定する.
Intent#setDataメソッドを使って, 宛先のメールアドレスを設定する. (必須)
注) 複数人に同時に送信する場合, "mailto:xxx@gmail.com, yyy@yahoo.co.jp"といった風に記述する.
Intent#putExtraメソッドを使って, メールの各項目のデータを設定する. (オプション)
EXTRA_CC : CCするメールアドレス
EXTRA_BCC : BCCするメールアドレス
EXTRA_SUBJECT : 件名
EXTRA_TEXT : 本文
:
注1) CC, BCCについては, Yahoo!メールヘルプ参照.
注2) EXTRA_STREAMを使ったファイル添付はできない. ファイル添付する場合はメールに画像を添付するを参照.
startActivityメソッドを使って, メールを起動する.
package com.moonlight_aska.android.intentmail01;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class IntentMail01 extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button btn = (Button)findViewById(R.id.btn);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
// インテントのインスタンス生成
Intent intent = new Intent();
// インテントにアクション及び送信情報をセット
intent.setAction(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:xxx@gmail.com"));
intent.putExtra(Intent.EXTRA_SUBJECT, "TEST");
intent.putExtra(Intent.EXTRA_TEXT, "これはテストメールです.");
// メール起動
startActivity(intent);
}
});
}
}
2014年12月3日水曜日
2014年11月6日木曜日
Google Releases Open Source Nogotofail Network Traffic Security Testing Tool
Google today introduced a new tool for testing network traffic security called Nogotofail. The company has released it as an open source project available on GitHub, meaning anyone can use it, contribute new features, provide support for more platforms, and do anything else with the end goal of helping to improve the security of the Internet. The tool's main purpose is to test whether the devices or applications you are using are safe against known TLS/SSL vulnerabilities and misconfigurations. Nogotofail works on Android, iOS, Linux, Windows, Chrome OS, OSX, and "in fact any device you use to connect to the Internet."
登録:
投稿 (Atom)