package com.flysnow.send.mail;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
/**
* 发送邮件测试界面
* @author 飞雪无情 个人博客:http://flysnow.iteye.com/
* @since 2011-7-19
*/
public class SendEmailActivity extends Activity implements View.OnClickListener{
private Button mSendBtn;
private Button mSendToBtn;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mSendBtn=(Button)findViewById(R.id.send_btn);
mSendToBtn=(Button)findViewById(R.id.send_to_btn);
mSendBtn.setOnClickListener(this);
mSendToBtn.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch(v.getId()){
case R.id.send_btn:
startSendEmailIntent();
break;
case R.id.send_to_btn:
startSendToEmailIntent();
break;
}
}
private void startSendEmailIntent(){
Intent data=new Intent(Intent.ACTION_SENDTO);
data.setData(Uri.parse("mailto:qq10000@qq.com"));
data.putExtra(Intent.EXTRA_EMAIL, new String[]{"ls8707@163.com","ls8708@163.com"});
data.putExtra(Intent.EXTRA_CC, new String[]{"ls8709@163.com"});
data.putExtra(Intent.EXTRA_BCC, new String[]{"ls810@163.com"});
data.putExtra(Intent.EXTRA_SUBJECT, "这是标题");
data.putExtra(Intent.EXTRA_TEXT, "这是内容");
startActivity(data);
}
private void startSendToEmailIntent(){
Intent data=new Intent(Intent.ACTION_SEND);
data.putExtra(Intent.EXTRA_EMAIL, new String[]{"ls8707@163.com"});
data.putExtra(Intent.EXTRA_SUBJECT, "这是标题");
data.putExtra(Intent.EXTRA_TEXT, "这是内容");
data.putExtra(Intent.EXTRA_STREAM, Uri.parse(""));
//data.setType("text/plain");
startActivity(data);
}
}
评论30
最新资源