Hello Guys I am new to android and facing problem I have searched a lot but not getting solution m using DatePickerDialog box and when I am running the application it is selecting previous dates also though I have set minimum date. I have tried by subtracting 1 second also from current time. and DatePicker is Starting from January1990. I want it to start it from today and block previous dates. Thanks ...
public void OnButtonClickDate()
{
btn_date = (Button)findViewById(R.id.button);
edit_date = (EditText)findViewById(R.id.editText);
btn_date.setOnClickListener
(
new View.OnClickListener()
{
@Override
public void onClick(View view)
{
DatePickerDialog datePickerDialog = new DatePickerDialog(MainActivity.this, new DatePickerDialog.OnDateSetListener()
{
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth)
view.setMinDate(System.currentTimeMillis());
edit_date.setText(dayOfMonth + "-" + (monthOfYear + 1) + "-" + year);
}
}, mYear, mMonth, mDay);
datePickerDialog.show();
}
}
);
}