The below Resources$NotFoundException log results from user error and is easily fixed.

Uncaught handler: thread main exiting due to uncaught exception
android.content.res.Resources$NotFoundException: String resource ID #0x1
at android.content.res.Resources.getText(Resources.java:205)
at android.widget.TextView.setText(TextView.java:2809)

I get this error when I am trying to set a View’s text using an integer value like:

view.setText(iSomeInteger) // This is incorrect !

Instead, to set the text of a view using an integer, you need to do:

view.setText(Integer.toString(iSomeInteger)) // setText with an int

The problem is that setText(int) is reserved for string resource ids, like:

view.setText(R.string.someStringId) // setText with a string resource id

The last part of this puzzle is when you want to concatenate a string resource with other text, you need to use getString(int). Otherwise you will end up with the string resource id (not the string itself) as part of your new text:

// concatenate a string with a string resource

view.setText("Some Text: " + getString(R.string.someStringId))

 

TextView 只接受是String类型的值