Android how to convert int to String? [duplicate]
Solution 1:
Use this String.valueOf(value);
Solution 2:
Normal ways would be Integer.toString(i)
or String.valueOf(i)
.
int i = 5;
String strI = String.valueOf(i);
Or
int aInt = 1;
String aString = Integer.toString(aInt);
Solution 3:
You called an incorrect method of String class, try:
int tmpInt = 10;
String tmpStr10 = String.valueOf(tmpInt);
You can also do:
int tmpInt = 10;
String tmpStr10 = Integer.toString(tmpInt);