错误:(20)错误:避免片段中的非默认构造函数:使用默认构造函数加片段#setArguments(Bundle)而不是[ValidFragment]

时间:2014-09-02 05:21:24

标签: android fragment bundle

我怎样才能避免这种情况.. 我可以运行我的应用程序没有任何错误。但是当我生成APK时,它会收到此错误。 我不知道如何解决这个错误 请帮助!!

public class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener {
DatabaseAdapter databaseHelper;
public EditText activity_edittext;

public DatePickerFragment(EditText edit_text) {

    activity_edittext = edit_text;

}
public DatePickerFragment(){}
@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);
    databaseHelper = new DatabaseAdapter(getActivity());
    // Create a new instance of DatePickerDialog and return it
    return new DatePickerDialog(getActivity(), this, year, month, day);
}

@Override
public void onDateSet(DatePicker view, int year, int month, int day) {
    activity_edittext.setText(String.valueOf(month + 1 ) + "/" + String.valueOf(day) + "/" + String.valueOf(year));


}


}

0 个答案:

没有答案