There is the following xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.ulnda.calendarapplication.MyCalendarView
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
MyCalendarView:
public class MyCalendarView extends CalendarView {
public MyCalendarView(Context context) {
super(context);
}
@Override
public void setOnClickListener(OnClickListener listener) {
// View v;
// v.setOn
}
@Override
public boolean performClick() {
Log.e("event", "perform_click");
return true;
}
}
All is good, but when I’m trying to execute this application I’ll have got the following message:
10-19 12:59:30.037: E/AndroidRuntime(30968): FATAL EXCEPTION: main
10-19 12:59:30.037: E/AndroidRuntime(30968): android.view.InflateException: Binary XML file line #7: Error inflating class com.ulnda.calendarapplication.MyCalendarView
How can I fix it?
Try to add these constructors too