- xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android=""
- android:orientation="vertical" android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <TextView android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:text="@string/hello" />
- <Button android:text="直接获取数据" android:id="@+id/Button01"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content">
- Button>
- <Button android:text="GET方式传递" android:id="@+id/Button02"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content">
- Button>
- <Button android:text="POST方式传递" android:id="@+id/Button03"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content">
- Button>
- <Button android:text="获取图片" android:id="@+id/Button04"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content">
- Button>
- LinearLayout>
- package com.Aina.Android;
- import android.app.Activity;
- import android.content.Intent;
- import android.os.Bundle;
- import android.view.View;
- import android.widget.Button;
- public class Test extends Activity {
-
- private Button btn1 = null;
- private Button btn2 = null;
- private Button btn3 = null;
- private Button btn4 = null;
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- btn1 = (Button) this.findViewById(R.id.Button01);
- btn2 = (Button) this.findViewById(R.id.Button02);
- btn3 = (Button) this.findViewById(R.id.Button03);
- btn4 = (Button) this.findViewById(R.id.Button04);
- btn1.setOnClickListener(new Button.OnClickListener(){
- public void onClick(View v) {
- Intent intent = new Intent();
- intent.setClass(Test.this, ShowData.class);
- Bundle b = new Bundle();
- b.putInt("id", 1);
- intent.putExtras(b);
- startActivity(intent);
- }
- });
- btn2.setOnClickListener(new Button.OnClickListener(){
- public void onClick(View v) {
- Intent intent = new Intent();
- intent.setClass(Test.this, ShowData.class);
- Bundle b = new Bundle();
- b.putInt("id", 2);
- intent.putExtras(b);
- startActivity(intent);
- }
- });
- btn3.setOnClickListener(new Button.OnClickListener(){
- public void onClick(View v) {
- Intent intent = new Intent();
- intent.setClass(Test.this, ShowData.class);
- Bundle b = new Bundle();
- b.putInt("id", 3);
- intent.putExtras(b);
- startActivity(intent);
- }
- });
- btn4.setOnClickListener(new Button.OnClickListener(){
- public void onClick(View v) {
- Intent intent = new Intent();
- intent.setClass(Test.this, ShowData.class);
- Bundle b = new Bundle();
- b.putInt("id", 4);
- intent.putExtras(b);
- startActivity(intent);
- }
- });
- }
- }
package com.Aina.Android;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class Test extends Activity {
/** Called when the activity is first created. */
private Button btn1 = null;
private Button btn2 = null;
private Button btn3 = null;
private Button btn4 = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btn1 = (Button) this.findViewById(R.id.Button01);
btn2 = (Button) this.findViewById(R.id.Button02);
btn3 = (Button) this.findViewById(R.id.Button03);
btn4 = (Button) this.findViewById(R.id.Button04);
btn1.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent();
intent.setClass(Test.this, ShowData.class);
Bundle b = new Bundle();
b.putInt("id", 1);
intent.putExtras(b);
startActivity(intent);
}
});
btn2.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent();
intent.setClass(Test.this, ShowData.class);
Bundle b = new Bundle();
b.putInt("id", 2);
intent.putExtras(b);
startActivity(intent);
}
});
btn3.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent();
intent.setClass(Test.this, ShowData.class);
Bundle b = new Bundle();
b.putInt("id", 3);
intent.putExtras(b);
startActivity(intent);
}
});
btn4.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent();
intent.setClass(Test.this, ShowData.class);
Bundle b = new Bundle();
b.putInt("id", 4);
intent.putExtras(b);
startActivity(intent);
}
});
}
}
- xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android=""
- android:orientation="vertical" android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <TextView android:id="@+id/TextView_HTTP"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content" />
- <ImageView android:id="@+id/ImageView01"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content">
- ImageView>
- LinearLayout>
阅读(892) | 评论(0) | 转发(0) |