Here is my code look like:
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);
}});