Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resource not found exception

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.

like image 490
Neha Mangla Avatar asked May 06 '26 01:05

Neha Mangla


1 Answers

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,..)

like image 140
Pragnani Avatar answered May 08 '26 18:05

Pragnani