Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. if (btnGram.isChecked()) {
  2.             float result = 0;
  3.             try {
  4.                 result = ProductCalculation.calculateGram(product.carbohydrates, getActivity(),
  5.                         s.toString());
  6.             } catch (NumberFormatException e) {
  7.                 productResultValue.setText("Некорректное значение");
  8.                 tvResultExplanation.setText("Некорректное значение");
  9.                 getActivity().runOnUiThread(new Runnable() {
  10.                     public void run() {
  11.                         productResultValue.setText("Некорректное значение");
  12.                         tvResultExplanation.setText("Некорректное значение");
  13.                     }
  14.                 });
  15.             }
  16.             productResultValue.setText(String.format(getString(R.string.value_gram), result));
  17.             glycemicIndex = value;
  18.             gram = (int) result;
  19.             tvResultExplanation.setText(value + " ХЕ это " + String.format("%.2f", result) + " грамм");
  20.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement