================================Test3_1===============================================
package com.test3;import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;public class Test3_1 extends Activity {
/** Called when the activity is first created. */
//@Override
TextView xs = null;
Button next = null;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
xs = (TextView) findViewById(R.id.hello);
next = (Button) findViewById(R.id.next);
next.setOnClickListener(new nextListenner());
}
class nextListenner implements OnClickListener{ Intent it = null;
Bundle bn = null;
public void onClick(View v) {
// TODO Auto-generated method stub
it = new Intent();
bn = new Bundle();
//it.putExtra("next1","go");
bn.putString("next1", "go");
it.putExtras(bn);
it.setClass(Test3_1.this,Test3_2.class);
startActivity(it);
}
}
}
================================Test3_2===============================================
package com.test3;import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;public class Test3_2 extends Activity {
TextView xs1 = null;
TextView xs2 = null;
TextView xs3 = null;
TextView xs4 = null;
Button next = null;
EditText num1 = null;
EditText num2 = null;
EditText fh = null;
Bundle bn = null;
Intent it = null;
String st = null;
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
xs1 = (TextView) findViewById(R.id.xs1);
num1 = (EditText) findViewById(R.id.num1);
xs2 = (TextView) findViewById(R.id.fh);
fh = (EditText) findViewById(R.id.fhk);
xs3 = (TextView) findViewById(R.id.xs2);
num2 =(EditText) findViewById(R.id.num2);
bn = getIntent().getExtras();
st = bn.getString("next1");
xs4.setText(st);
} class calcListenner implements OnClickListener{
public void onClick(View v) {
// TODO Auto-generated method stub
st = num1.getText().toString();
bn.putString("num1", st);
st = num1.getText().toString();
bn.putString("fh", st);
st = num1.getText().toString();
bn.putString("num2", st);
it.putExtras(bn);
it.setClass(Test3_2.this, Test3_3.class);
startActivity(it);
}
}
}================================Test3_3===============================================package com.test3;import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;public class Test3_3 extends Activity { TextView xs1 = null;
TextView xs2 = null;
Intent it = null;
Bundle bn = null;
String st = null;
String num1 = null;
String num2 = null;
String fh = null;
int ans = 0;
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main3);
bn = getIntent().getExtras();
st = bn.getString("next1");
xs1 = (TextView) findViewById(R.id.test1);
xs1.setText(ans);
fh = bn.getString("fh");
num1 = bn.getString("num1");
num2 = bn.getString("num2");
if(fh.equals("+"))
ans = Integer.parseInt("num1")+Integer.parseInt("num2");
if(fh.equals("-"))
ans = Integer.parseInt("num1")-Integer.parseInt("num2");
if(fh.equals("*"))
ans = Integer.parseInt("num1")*Integer.parseInt("num2");
if(fh.equals("/"))
ans = Integer.parseInt("num1")/Integer.parseInt("num2");
xs2 = (TextView) findViewById(R.id.jieguo);
xs2.setText(ans+"");
}
}
package com.test3;import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;public class Test3_1 extends Activity {
/** Called when the activity is first created. */
//@Override
TextView xs = null;
Button next = null;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
xs = (TextView) findViewById(R.id.hello);
next = (Button) findViewById(R.id.next);
next.setOnClickListener(new nextListenner());
}
class nextListenner implements OnClickListener{ Intent it = null;
Bundle bn = null;
public void onClick(View v) {
// TODO Auto-generated method stub
it = new Intent();
bn = new Bundle();
//it.putExtra("next1","go");
bn.putString("next1", "go");
it.putExtras(bn);
it.setClass(Test3_1.this,Test3_2.class);
startActivity(it);
}
}
}
================================Test3_2===============================================
package com.test3;import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;public class Test3_2 extends Activity {
TextView xs1 = null;
TextView xs2 = null;
TextView xs3 = null;
TextView xs4 = null;
Button next = null;
EditText num1 = null;
EditText num2 = null;
EditText fh = null;
Bundle bn = null;
Intent it = null;
String st = null;
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
xs1 = (TextView) findViewById(R.id.xs1);
num1 = (EditText) findViewById(R.id.num1);
xs2 = (TextView) findViewById(R.id.fh);
fh = (EditText) findViewById(R.id.fhk);
xs3 = (TextView) findViewById(R.id.xs2);
num2 =(EditText) findViewById(R.id.num2);
bn = getIntent().getExtras();
st = bn.getString("next1");
xs4.setText(st);
} class calcListenner implements OnClickListener{
public void onClick(View v) {
// TODO Auto-generated method stub
st = num1.getText().toString();
bn.putString("num1", st);
st = num1.getText().toString();
bn.putString("fh", st);
st = num1.getText().toString();
bn.putString("num2", st);
it.putExtras(bn);
it.setClass(Test3_2.this, Test3_3.class);
startActivity(it);
}
}
}================================Test3_3===============================================package com.test3;import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;public class Test3_3 extends Activity { TextView xs1 = null;
TextView xs2 = null;
Intent it = null;
Bundle bn = null;
String st = null;
String num1 = null;
String num2 = null;
String fh = null;
int ans = 0;
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main3);
bn = getIntent().getExtras();
st = bn.getString("next1");
xs1 = (TextView) findViewById(R.id.test1);
xs1.setText(ans);
fh = bn.getString("fh");
num1 = bn.getString("num1");
num2 = bn.getString("num2");
if(fh.equals("+"))
ans = Integer.parseInt("num1")+Integer.parseInt("num2");
if(fh.equals("-"))
ans = Integer.parseInt("num1")-Integer.parseInt("num2");
if(fh.equals("*"))
ans = Integer.parseInt("num1")*Integer.parseInt("num2");
if(fh.equals("/"))
ans = Integer.parseInt("num1")/Integer.parseInt("num2");
xs2 = (TextView) findViewById(R.id.jieguo);
xs2.setText(ans+"");
}
}
[2011-09-09 11:20:15 - Test3] Android Launch!
[2011-09-09 11:20:15 - Test3] adb is running normally.
[2011-09-09 11:20:15 - Test3] Performing com.test3.Test3_1 activity launch
[2011-09-09 11:20:15 - Test3] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD '2.3'
[2011-09-09 11:20:15 - Test3] Uploading Test3.apk onto device 'emulator-5554'
[2011-09-09 11:20:16 - Test3] Installing Test3.apk...
[2011-09-09 11:20:30 - Test3] Success!
[2011-09-09 11:20:30 - Test3] Starting activity com.test3.Test3_1 on device emulator-5554
[2011-09-09 11:20:32 - Test3] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.test3/.Test3_1 }
09-09 03:57:36.396: INFO/ActivityManager(69): Process com.test3 (pid 506) has died.
09-09 03:57:36.424: ERROR/InputDispatcher(69): channel '40770d08 com.test3/com.test3.Test3_1 (server)' ~ Consumer closed input channel or an error occurred. events=0x8
09-09 03:57:36.424: ERROR/InputDispatcher(69): channel '40770d08 com.test3/com.test3.Test3_1 (server)' ~ Channel is unrecoverably broken and will be disposed!
09-09 03:57:36.525: INFO/WindowManager(69): WIN DEATH: Window{40770d08 com.test3/com.test3.Test3_1 paused=false}
09-09 03:57:36.605: INFO/WindowManager(69): WIN DEATH: Window{408084f8 com.test3/com.test3.Test3_2 paused=false}
09-09 03:57:36.905: ERROR/InputDispatcher(69): Received spurious receive callback for unknown input channel. fd=175, events=0x8
09-09 03:57:37.284: WARN/InputManagerService(69): Got RemoteException sending setActive(false) notification to pid 506 uid 10036
能发送一个简单点的计算器源码给我吗?发送到:[email protected] 谢谢