我正在制作一个计算器,在尝试制作平方根函数时,它会输出您输入的数字,而不是平方根。这是适用于平方根函数的代码。
SquareRoot = (Button)findViewById(R.id.SquareRoot);
        SquareRoot.setOnClickListener(new OnClickListener() {
             public void onClick(View v) {
                x = TextBox.getText();
                xconv = Double.parseDouble(x.toString());
                Math.sqrt(xconv);
                answer = Double.toString(xconv);
                TextBox.setText(answer);
        }});
Just to give some information on this, x is a CharSequence, xconv is x converted to double, and answer is a string value. Thanks.