I have this piece of code:
ed = (EditText) findViewById (R.id.box);
int x = 10;
ed.setText (x);
It turns out to be an error. I know I have to change it to string, but how do I do this?
I've tried x.toString()
, but it can't be compiled.
I have this piece of code:
ed = (EditText) findViewById (R.id.box);
int x = 10;
ed.setText (x);
It turns out to be an error. I know I have to change it to string, but how do I do this?
I've tried x.toString()
, but it can't be compiled.
Try using
String.format()
:Use
+
, the string concatenation operator:or use
String.valueOf(int)
:or use
Integer.toString(int)
:try
Integer.toString(integer value);
method asUse this in your code: