Need to convert it to string?

result.setText(valueX); // не катит; result.setText(valueX + ""); // не нравится 
  • one
    And here IntelliJ IDEA? You can write setText(Integer.toString(valueX)) , so roll. ..in the Integer specify the primitive type declared for your number. - pavlofff

1 answer 1

If the setText () function is passed an integer, it will interpret it as a resource identifier and will search for such a string in the resources. To display a number on View, you must first bring it to a string. You can do it like this:

 result.setText(Integer.toString(valueX)); 

or so:

 result.setText(String.valueOf(valueX)); 

or so:

 result.setText(valueX + ""); 
  • Thank you very much! - J. Defenses