如何在一次点击按钮中进行多个计算操作-android-

如何在一次点击按钮中进行多个计算操作-android-,android,android-edittext,Android,Android Edittext,我尝试在一次单击中进行多个计算操作,但当我单击按钮时,显示错误,因此如何修改此代码,以便能够在一次单击中计算所有这些操作,而不出现任何错误。这是密码 public class calcit extends Activity { EditText onehighx,twowightx,threefinallresultx,four100x,fiveresultof100x,sixresultofresultx; Button donee; BigDecimal onehigh,twowight,

我尝试在一次单击中进行多个计算操作,但当我单击按钮时,显示错误,因此如何修改此代码,以便能够在一次单击中计算所有这些操作,而不出现任何错误。这是密码

public class calcit extends Activity {

EditText onehighx,twowightx,threefinallresultx,four100x,fiveresultof100x,sixresultofresultx;
Button donee;
BigDecimal onehigh,twowight,threefinallresult,four100,fiveresultof100,sixresultofresult;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.calcit);

    donee = (Button) findViewById(R.id.button1);
    onehighx = (EditText) findViewById(R.id.high);// high
    twowightx = (EditText) findViewById(R.id.Weight);//Weight
    threefinallresultx = (EditText) findViewById(R.id.finall_result);//result =Weight * result of result 100
    four100x = (EditText) findViewById(R.id.e100);//100
    fiveresultof100x = (EditText) findViewById(R.id.re_of_100);// result of 100 = high * 100 
    sixresultofresultx = (EditText) findViewById(R.id.result_of_100_100);// result of result 100 /ex : 1.75*1.75

    donee.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

            onehigh = new BigDecimal(onehighx.getText().toString());
            twowight= new BigDecimal(twowightx.getText().toString());
            threefinallresult = new BigDecimal(threefinallresultx.getText().toString());
            four100 = new BigDecimal(four100x.getText().toString());
            fiveresultof100 = new BigDecimal(fiveresultof100x.getText().toString());
            sixresultofresult = new BigDecimal(sixresultofresultx.getText().toString());

           //---here i want to fix this code to be able to show all of this Multiple-calc operations in 
            //(threefinallresultx)------

            fiveresultof100x.setText((onehigh).divide(four100).toString());
            sixresultofresultx.setText((fiveresultof100).multiply(fiveresultof100).toString());
            threefinallresultx.setText((twowight).divide(sixresultofresult).toString());

        }
    });



}

如果我没有错的话,您希望对从EditText获取的值进行计算,但是您尝试对setText框进行除法或乘法,而不是对其中包含的值进行除法或乘法。因此,只需以适当的格式获取值并正常计算它们,如

onehigh=onehigh/four100;
fiveresultof100=fiveresultof100*fiveresultof100;
twowight=twowight/sixresultofresult;
然后在文本框中设置它们

fiveresultof100x.setText(onehigh);
ixresultofresultx.setText(fiveresultof100);
threefinallresultx.setText(twowight);