1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | package com.msi.ibm; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.Button; import android.widget.TextView; import android.content.Intent; import android.util.Log; public class XmlGui extends Activity { final String tag = XmlGui.class.getName(); /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button btnRunForm = (Button) this.findViewById(R.id.btnRunForm); btnRunForm.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { EditText formNumber = (EditText) findViewById(R.id.formNumber); Log.i(tag,"Attempting to process Form # [" + formNumber.getText().toString() + "]"); Intent newFormInfo = new Intent(XmlGui.this,RunForm.class); newFormInfo.putExtra("formNumber", formNumber.getText().toString()); startActivity(newFormInfo); } }); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" androidrientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Title" /> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" androidrientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" > <EditText android:layout_width="100px" android:layout_height="wrap_content" android:text="1" android:id="@+id/formNumber" android:numeric="integer"/> <Button android:text="Run Form" android:id="@+id/btnRunForm" android:layout_width="wrap_content" android:layout_height="wrap_content"> </Button> </LinearLayout> </LinearLayout> |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |