android.content.res.Resources$NotFoundException: String resource ID #0x1 Error [duplicate]

Solution 1:

Instead of

rollNo.setText(items[position].getRollNo());

you should use

rollNo.setText(Integer.toString(items[position].getRollNo()));

If you try to set integer as text, you call method setText(int resID) and application try to set as text some string resource with this resID.

Solution 2:

SetText doesnt allow integer values

Just Add ""+ for your code to look like this ""+rollNo.setText(items[position].getRollNo());

this error occurs because setText does not take Integers, it takes Strings

Solution 3:

You can also use

String.valueOf()

in your code to avoid the Resource Not Found Exception .

Your code will look like this

rollNo.setText(String.valueOf(items[position].getRollNo()));

It will work perfectly fine because the SetText() only requires strings as values to be passed on.