How to convert int to String Android Java

How to set int to Textview in Android Java

You can’t directly set an int value to a string for textview or other. for example, see this

int size = 100;

textview.setText(size);

The above code will not work, this will give compile error or crash

 

But the following code will work, because we are converting the int  to string

int size = 100;
textview.setText(String.valueOf(size));

 

, ,

Post navigation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.