When i try to set the minimum date for the DatePicker view it gives me this error:
Call requires API level 11 (current min is 8): android.widget.DatePicker#setMinDate
My java is:
datePicker = (DatePicker) findViewById(R.id.date_picker_id);
datePicker.setMinDate(System.currentTimeMillis() - 259200000);
My XML:
<DatePicker
android:id="@+id/date_picker_id"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:layout_below="@id/header_id"
/>
How do i solve this error?
The DataPicker.setMinDate()
method was added only in android API level 11 (Android 2.3.4 I guess)... But in your AndroidManifest.xml
you have set the minSDKVersion=8
(Android 2.2)...
So obviously when some device running version 2.2 executes your code, it won't know about the setMinDate()
method... Hence the error...
To Fix:
minSDKVersion
to 11
. But people with android OS less than 2.3.4 will not be able to install your app.