Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. subtractButton.setOnClickListener(l -> {
  2. if (value1.getText().toString().isEmpty() || value2.getText().toString().isEmpty()) {
  3. Toast.makeText(this, "Введите сначала значения", Toast.LENGTH_LONG).show();
  4. resultView.setText("ERROR");
  5. return;
  6. }
  7. Float v1 = Float.parseFloat(value1.getEditableText().toString());
  8. Float v2 = Float.parseFloat(value2.getEditableText().toString());
  9. Float result = v1 - v2;
  10. resultView.setText(result.toString());
  11. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement