Getting android.content.res.Resources$NotFoundException: exception even when the resource is present in android
For my condition the cause was taking int
parameter for TextView
. Let me show an example
int i = 5;
myTextView.setText(i);
gets the error info above.
This can be fixed by converting int
to String
like this
myTextView.setText(String.valueOf(i));
As you write int
, it expects a resource not the text that you are writing. So be careful on setting an int
as a String
in Android.
- in eclipse, go to Project > Clean...
- select your project, then press OK
- relaunch the app
if it happens again delete the r.java file. it will generate automatically.
Since you are setting the layout explicitly you might want to try and put it in the default /layout folder not in the /layout-land since that is if you want Android to automatically handle rotation for you.