Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (btnGram.isChecked()) {
- float result = 0;
- try {
- result = ProductCalculation.calculateGram(product.carbohydrates, getActivity(),
- s.toString());
- } catch (NumberFormatException e) {
- productResultValue.setText("Некорректное значение");
- tvResultExplanation.setText("Некорректное значение");
- getActivity().runOnUiThread(new Runnable() {
- public void run() {
- productResultValue.setText("Некорректное значение");
- tvResultExplanation.setText("Некорректное значение");
- }
- });
- }
- productResultValue.setText(String.format(getString(R.string.value_gram), result));
- glycemicIndex = value;
- gram = (int) result;
- tvResultExplanation.setText(value + " ХЕ это " + String.format("%.2f", result) + " грамм");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement