1
Answer

I want to use two datepicker in same activity

  datefrom=(EditText)findViewById(R.id.date1);

dateto = (EditText) findViewById(R.id.date2);

datefrom.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DatePickerBuilder dp1 = new DatePickerBuilder()
.setFragmentManager(getSupportFragmentManager())
.setStyleResId(R.style.BetterPickersDialogFragment)
.setYearOptional(true);

dp1.show();

}
});
dateto.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DatePickerBuilder dp2 = new DatePickerBuilder()
.setFragmentManager(getSupportFragmentManager())
.setStyleResId(R.style.BetterPickersDialogFragment)
.setYearOptional(true);

dp2.show();
}
});



}
@Override
public void onDialogDateSet(int reference, int year, int monthOfYear, int dayOfMonth) {
monthOfYear+=1;
datefrom.setText(dayOfMonth+"/"+ monthOfYear+"/"+year);
}
Answers (1)