我創建了一個日期選擇器,如圖所示。它顯示當我在標籤上運行該程序,但當我嘗試它的手機(HTC Glacier)應用程序崩潰時,我可以找出我錯過了什麼東西。請幫幫我。由於在android中的datepicker錯誤
這裏是我的logcat:
06-24 16:52:05.003: E/AndroidRuntime(19717): Caused by: java.lang.IllegalArgumentException: current should be >= start and <= end
06-24 16:52:05.003: E/AndroidRuntime(19717): at android.widget.NumberPicker.setCurrent(NumberPicker.java:288)
06-24 16:52:05.003: E/AndroidRuntime(19717): at android.widget.DatePicker.updateSpinners(DatePicker.java:384)
06-24 16:52:05.003: E/AndroidRuntime(19717): at android.widget.DatePicker.init(DatePicker.java:379)
06-24 16:52:05.003: E/AndroidRuntime(19717): at ph.com.unilab.iReport.IreportMain.onCreate(IreportMain.java:85)
這裏是我的主要活動代碼,日期選擇
....
calendar = Calendar.getInstance();
dp_Date = (DatePicker) findViewById(R.id.dp_Date);
dp_Date.init(80, calendar.get(Calendar.MONTH), calendar.get(Calendar.DATE), null);
dp_Date.setDescendantFocusability(DatePicker.FOCUS_BLOCK_DESCENDANTS);
dp_Date.init(2013, calendar.getTime().getMonth(), calendar.getTime().getDate(), new OnDateChangedListener()
{
public void onDateChanged(DatePicker view, int year, int monthOfYear,int dayOfMonth) {
}
});
....
問題檢查這些東西正常.. –