DateFormat производят неправильный год
выше картина выбора даты, после того, как я нажимаю ОК, результат показан ниже.
Код, как следовать
public class DatePickerFragment extends DialogFragment
implements DatePickerDialog.OnDateSetListener {
@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(), this, year, month, day);
}
public void onDateSet(DatePicker view, int year, int month, int day) {
// Do something with the date chosen by the user
Date date = new Date(year, month, day);
Fragment fragment = getActivity().getFragmentManager().findFragmentByTag(ConvocationAddDialogFragment.class.getName());
TextView textView = (TextView) fragment.getView().findViewById(R.id.open_registration_date);
textView.setText(DateFormat.getDateInstance().format(date));
}
}
Ожидаемое значение 18 января 2016, почему это отображение 18 янв 3916?
Хорошо swer. Вы можете принять это. –