I want to calculate a value from the data in 2 text edits and show the result in a textview. How can I do it?
BMI calculator:
private TextView deinbmi;
private EditText weight;
private EditText height;
public void calculator ()
{
double ergebnis;
weight=(EditText)findViewById(R.id.text_calculator_weight);
height=(EditText)findViewById(R.id.text_calculator_height);
double a=Double.parseDouble(weight.getText().toString());
double b=Double.parseDouble(height.getText().toString());
ergebnis=a*b;
deinbmi.setText(""+ergebnis);
}
I don't have an idea; I just started with Java. I can program with C++ but just console.
If I search on the internet for this problem, everyone has another version of solving this, but none of these answers worked for me?
is my activity
i tryed to use your code but
he didnt understand this