Resources Not Found Exception


wait 4 ideas

In Android a very common error you can get is Resources Not Found Exception, has you can see below:

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

This happens when you try to set a View’s text with a integer value, yes the .setText(int) function exists, but it is reserved for string resource ids only, the ones you set in strings.xml in values, for example: R.string.myStringId
This is why the setText(int) function exists:

myView.setText(R.string.myStringId); //this works

But if you’re doing something like

myView.setText(someInt); // this is wrong!!

You will get this error, if you really want to write someInt in the view’s text, you will need to do this:

myView.setText(Integer.toString(someInt)); //this works

And if you want to write a text concatenating a string with a resource id of another string?
Well, in that case you use the .getString(int) function, like…

View original post 6 more words


About Tom105

am real
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s