1

Is there any way to change the date picker of OnePlus 3t. I can only traverse only through months. imagine setting dob for a 30+ yr old guy.

date picker image

Android 8.0
Oxygen OS 5.0.2

  • Touch on year on top left of your screen to navigate year wise, in your case please touch 2001 above sat. – Bhoomit_BB Apr 21 '18 at 12:11
  • Please post as answer. I touched everything except that. I didn't notice it before. May be because it's grayed out meaning disabled. – Jose Tuttu Apr 21 '18 at 12:30
  • actually I'm developer and I also don't prefer this date picker as android didn't provide it as user friendly, I always prefer HOLO theme scroll picker, because client always complains on this. – Bhoomit_BB Apr 21 '18 at 13:18
3

Just click on the year (showing on the top eg - 2001) then you can change the year It will show list of years like this:

enter image description here

0

Try this code for date picker.

final Calendar mcurrentDate = Calendar.getInstance();
final int mYear = mcurrentDate.get(Calendar.YEAR);
final int mMonth = mcurrentDate.get(Calendar.MONTH);
final int mDay = mcurrentDate.get(Calendar.DAY_OF_MONTH);

android.app.DatePickerDialog mDatePicker = new android.app.DatePickerDialog(Newtripactivity.this, new android.app.DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker datepicker, int selectedyear, int selectedmonth, int selectedday) {

Calendar calander2 = Calendar.getInstance();
calander2.setTimeInMillis(0);
calander2.set(selectedyear, selectedmonth, selectedday, 0, 0, 0);
Date SelectedDate = calander2.getTime();
startDate = calander2.getTimeInMillis();

// TODO Auto-generated method stub
DateFormat dateformat_US = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.US);
String StringDateformat_US = dateformat_US.format(SelectedDate);
                    startdate.setText(StringDateformat_US);
                }
            }, mYear, mMonth, mDay);
mDatePicker.setTitle("Select date");
mDatePicker.show();
  • 1
    FYI - This is a site for users of Android not developers. – bmdixon Apr 21 '18 at 18:11
  • Sorry! i didn't get you. For Android Programming, u need the code only right. – lakshmi Apr 23 '18 at 6:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.