Witam Dopiero zaczynam bawic sie andoidem i mam nastepujacy problem.Pisze swoj kalkulator BMI i gdy zostawie puste pola aplikacja przestaje dzialac zrobilem do tego kod ale nie dziala wlasnie tylko to zostawianie pustych pol .Prosil bym o Pomoc z gory Dziekuje
public void Oblicz_BMI(View view) {
double tempWeight;
double tempHeight;
double YourBMI;
EditText Weight = (EditText) findViewById(R.id.WeightID);
tempWeight = parseDouble(Weight.getText().toString());
EditText Height = (EditText) findViewById(R.id.HeightID);
tempHeight = parseDouble(Height.getText().toString());
if (Weight.getText().toString().isEmpty())
{
Toast emptyWeight = Toast.makeText(MainActivity.this,"Weight TextField is Empty",Toast.LENGTH_SHORT);
emptyWeight.show();
}
if (Height.getText().toString().isEmpty())
{
Toast emptyHeight = Toast.makeText(MainActivity.this,"Height TextField is Empty",Toast.LENGTH_SHORT);
emptyHeight.show();
}
YourBMI = tempWeight / ((tempHeight*tempHeight)/10000);
Intent intent = new Intent(MainActivity.this,Druga.class);
intent.putExtra("BMI",YourBMI);
startActivity(intent);