I’m using this code to set the id of any button:
String s = "" + i + j;
int getal = Integer.parseInt(s);
button.setId(getal);
Variables “i” and “j” are always from 0 tot 9. A single digit. However, if “i” is 0 then the parseInt() method deletes it, I think.
For example: when i=0 and j=6 the outcome of variable “getal” wil be 6 and not 06. I need it to be 06. Does somebody maybe know an other way of converting strings to ints?
An Integer can’t be “06” – it is either 6 or it is a String.
So, the
setIdwill not see any difference between “06” and “6”.If you really need the leading Zero, you could either save it as a
Stringor as anint[]