Reputation: 1054
I am trying to use datepicker in my project. But as soon as I run the project, it throws "Resource not found exception" and following line appears when I drag datepicker in xml file
The following classes could not be found:
- CalendarView (Change to android.widget.CalendarView, Fix Build Path, Edit XML)
- DatePicker (Change to android.widget.DatePicker, Fix Build Path, Edit XML)
logcat entries are as follows:
FATAL EXCEPTION:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.dateandtimepick/com.example.dateandtimepick.MainActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x16
How can I rectify the code. Thanks in advance.
Upvotes: 2
Views: 4421
Reputation: 339
I solved the "Resource not found" exception by re-installing the Android SDK. For some reason, while packing the apk, the SDK tools weren't packing the resources. Its' a build error (silent error) that yells only at runtime. I did not need to reinsatll JDK or eclipse.
Upvotes: 0
Reputation: 350
Try to clean to Project to rebuild the R.java
Rebuild the xml by creating a new xml,I guess maybe you forget to add the namespace (xmlns:android="http://schemas.android.com/apk/res/android")
Hope I can help.
Upvotes: -1
Reputation: 20155
android.content.res.Resources$NotFoundException: String resource ID #0x16
You are trying to set int
value in
tetview.setText()
or Toast.makeText()
, which it will take as string resource id.
So try to give int value in like this
.setText(""+intvalue)
or Toast.makeText(context,""+intvalue,..)
Upvotes: 11