2012-03-05 51 views
0

我有一個問題,試圖在點擊按鈕創建事件的對話,但沒有從那裏我可以在這裏選擇日期對話框是我的代碼android,當我嘗試調用datepickerdialog它不顯示?

我對buttonCLick的ShowDialog調用(2);

protected Dialog onCreateDialog(int id) 
{ 
    switch (id) 
    { 
     case 2:return showDatePicker(); 
    } 

    return dialog; 
} 

private DatePickerDialog showDatePicker() 
{ 
    DatePickerDialog datePicker= new DatePickerDialog(dodadi.this, new DatePickerDialog.OnDateSetListener() { 
     //@Override 
     public void onDateSet(DatePicker view, int year, int monthOfYear,int dayOfMonth) 
     { 
      mCalendar.set(Calendar.YEAR,year); 
      mCalendar.set(Calendar.MONTH,monthOfYear); 
      mCalendar.set(Calendar.DAY_OF_MONTH,dayOfMonth); 
      updateDateButtonText(); 
      //super.onDateSet(view,year,monthOfYear,dayOfMonth); 
     } 
    }, mCalendar.get(Calendar.YEAR),mCalendar.get(Calendar.MONTH),mCalendar.get(Calendar.DAY_OF_MONTH)); 

    return datePicker; 
} 

回答

0

也許它的進口,因爲該代碼是正確的嘗試進口android.app.DatePickerDialog;它可以是部件而不是應用程序:)愚蠢的錯誤

相關問題