spinner 下拉运算选项,简单计算器问题
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
String[] lan = getResources().getStringArray(R.array.signed);
Toast.makeText(MainActivity.this, "你选择的是: " + lan[arg2],
Toast.LENGTH_LONG).show();
}
******
public void CalcStart(View v) {
Log.d("TAG", "CalcStart()");
EditText num1Edit = (EditText) findViewById(R.id.num1EDIT);
String strNum1 = num1Edit.getText().toString();
int num1 = Integer.parseInt(strNum1);
EditText num2Edit = (EditText) findViewById(R.id.num2EDIT);
String strNum2 = num2Edit.getText().toString();
int num2 = Integer.parseInt(strNum2);
if ( 这里应该怎么调用.equals("+") ){
int result = num1 + num2;
}
else if ( ){
int result = num1 * num2;
}
else if (){
int result = num1 - num2;
}
else if(){
int result = num1 / num2;
}
int result = num1 * num2;
TextView resultText = (TextView) findViewById(R.id.resultTXT);
resultText.setText("= " + result);
}