随笔 - 23  文章 - 0 评论 - 14 trackbacks - 0

直接奔主题~!

结构如图:

Send_EmailActivity.java代码:

public class Send_EmailActivity extends Activity {

	private EditText to_txt;
	private EditText subject_txt;
	private EditText content_txt;
	private Button submit_btn;
	private Button reset_btn;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		findAll();
		bind();
	}

	public void findAll() {
		to_txt = (EditText) this.findViewById(R.id.to_txt);
		content_txt = (EditText) this.findViewById(R.id.content_txt);
		submit_btn = (Button) this.findViewById(R.id.submit_btn);
		reset_btn = (Button) this.findViewById(R.id.reset_btn);
		subject_txt = (EditText) this.findViewById(R.id.subject_txt);
	}

	public void bind() {
		submit_btn.setOnClickListener(mylistener);
		reset_btn.setOnClickListener(mylistener);
	}

	private View.OnClickListener mylistener = new OnClickListener() {

		public void onClick(View v) {
			// TODO Auto-generated method stub
			Intent i = new Intent(Intent.ACTION_SEND);
			i.setType("text/plain"); // 模拟器请使用这行
			// i.setType("message/rfc822") ; // 真机上使用这行
			String receive = to_txt.getText().toString().trim();
			i.putExtra(Intent.EXTRA_EMAIL, new String[] { receive });
			i.putExtra(Intent.EXTRA_SUBJECT, subject_txt.getText().toString()
					.trim());
			i.putExtra(Intent.EXTRA_TEXT, content_txt.getText().toString()
					.trim());
			startActivity(Intent.createChooser(i, "send"));
			
		}

	};
}

main.xml代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="vertical" android:layout_width="fill_parent"
	android:layout_height="fill_parent">
	<TextView android:text="收件人" android:id="@+id/textView1"
		android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
	<EditText android:layout_width="fill_parent" android:id="@+id/to_txt"
		android:layout_height="wrap_content">
		<requestFocus></requestFocus>
	</EditText>
	<TextView android:text="内容" android:id="@+id/textView2"
		android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
	<EditText android:layout_width="fill_parent" android:id="@+id/content_txt"
		android:layout_height="wrap_content"></EditText>
	<TextView android:text="主题" android:id="@+id/textView4"
		android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
	<EditText android:layout_width="fill_parent" android:id="@+id/subject_txt"
		android:layout_height="wrap_content"></EditText>
	
	<LinearLayout android:gravity="center"
		android:layout_width="fill_parent" android:id="@+id/linearLayout1"
		android:layout_height="wrap_content">
		<Button android:id="@+id/submit_btn" android:text="submit"
			android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
		<Button android:id="@+id/reset_btn" android:text="reset"
			android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
	</LinearLayout>
</LinearLayout>

 

androidManifest.xml代码:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="Send_Email.Jason"
      android:versionCode="1"
      android:versionItamail.Jason"
     Cdroid:ql>1=Itamail.Jason"
     prttpa:versionItamail.JaCon"
 ql>2onCode="1"
      android:versionItamail.Jn2onCCkomoid:ls="byoutthg/id:ltton>
	&b
i
<-ndr"?&a:versionIvers/p>
t void oa:versd:versionI/tamail.Jn2nbsp;

m/apk/renifest.xml代码:直MySignaturefaultCalbrush:java;colllandfaultCalbrush:j 23 ~! s="pethod ty.j-09-22 16:50 <理
>编辑"myl :la藏class=tCalbrupt type = 'jason-jo', cb_enable_mathjax=faa/divC9bJgt;s=t; ,cb_nbsgId=96010,ipt> tryI23iv> <,cb_nbsgApp=lse;var isLogi,cb_nbsgUiv>Gu 23'950615c2-13d2-ey.j-8ee0-842b2b196315',ipt> tryayout.dDut.='_Emai tryI2)dles/://www. =1">
<'DIV> tryI2)d }, 50] { versdeliasoAdT2(] { versdeliasoAdC1(] { versdeliasoAdC2(] vers{ vers tryI2criptnbsgAppcriptnbsgUiv>Gu 2] { versGetPlvNIV> tryI2criptnbsgIdcript> tryayout.dDut.,/://www. ] { vers tryayout.dDut.] ver码/div>