日期:2014-05-20 浏览次数:20836 次
package com.he;
import android.app.Activity;
import android.os.Bundle;
import android.text.InputType;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class CalculatorActivity extends Activity {
//加plus 减subtract 乘multiply 除divide
private EditText etResult; //文本框显示结果
private Button btPlus; //加
private Button btSub; //减
private Button btMultiply; //乘
private Button btDivide; //除
private Button btDelete; //删
private Button btCe; //清空
private Button btPoint; //点
private Button btDeng; //等于
private Button bt0;
private Button bt1;
private Button bt2;
private Button bt3;
private Button bt4;
private Button bt5;
private Button bt6;
private Button bt7;
private Button bt8;
private Button bt9;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
etResult=(EditText)findViewById(R.id.etResult);
btPlus=(Button)findViewById(R.id.btPlus);
btSub=(Button)findViewById(R.id.btSubtract);
btMultiply=(Button)findViewById(R.id.btMultiply);
btDivide=(Button)findViewById(R.id.btDivide);
btDelete=(Button)findViewById(R.id.btDelete);
btDeng=(Button)findViewById(R.id.btDeng);