你好,我遇到這個錯誤,而帽子從何而來?(公共構造不帶參數)(tr.dailyplus.berkaykara.fragments.DatePickerFragment)ValidFragment]
錯誤:錯誤:該片段應提供一個默認的構造(不帶參數的公共構造)(tr.dailyplus.berkaykara.fragments.DatePickerFragment)[ValidFragment]
DatePickerDialog.OnDateSetListener callback;
/**
* Constructor
* @param callback - callback function when a date has been selected
*/
public DatePickerFragment(DatePickerDialog.OnDateSetListener callback) {
this.callback = callback;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current date as the default date in the picker
final Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
// Create a new instance of DatePickerDialog and return it
return new DatePickerDialog(getActivity(), callback, year, month, day);
}
}