I want to set a TextView
as the value of an integer, hopefully like so:
tv.setText(int)
I tried this an I get this error.
Doing setText(int) you are refering to an application resource from the XML files, not the value itself.
To set the integer propertly do the following:
tv.setText(""+integer);
or better solution:
tv.setText(String.valueOf(integer));
Generally,
tv.setText(String.valueOf(int));
If the value is inside another class? You can make a getter for the value you want in that class:
public int getValue() {
return value;
}
So that you can access it from the other one:
BUT if you set a TextView to an int, it will be interpreted as an Android resource id. If you want the value of the int as your text (and not the resource it points to), make it a String first.
tv.setText(String.valueOf(theOtherClassInstance.getValue()));
EDIT If your int is firstResult
as per your comment below, then the getter becomes:
public int getFirstResult() {
return firstResult;
}