When you pass an integer to the TextView.setText() to be displayed android assumes it is a resource id and that's why you are getting Resource$NotFoundException. Try converting the int to String before passing it to TextView.setText(): TextView.setText(String.valueOf(i)).