Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Date Picker Material Design

    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 1.02k
    Comment on it

    I am writing way to add and use date Picker Material design library to our project. First of all we need to add library to our build.gradle file

    dependencies {
    compile 'com.wdullaer:materialdatetimepicker:1.5.4'
    }
    

    Then we need to implements OnDateSetListener to our Activity or Fragment and after it we need to override its method onDateSet() that will invoke when you choose the date.

    @Override
    public void onDateSet(DatePickerDialog view, int yr, int mtnYr, int dayMonth) {
    String date = "dayMonth +"/"+( mtnYr +1)+"/"+yr;
    textViewDate.setText(date);
    }
    

    To open date Picker we need to implement this:

    Calendar calendar = Calendar.getInstance();
    DatePickerDialog datePicker = DatePickerDialog.newInstance(
    MyActivity.this,
    calendar.get(Calendar.YEAR),
    calendar.get(Calendar.MONTH),
    calendar.get(Calendar.DAY_OF_MONTH)
    );
    datePicker.show(getFragmentManager(), "datepicker");

 1 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: