In registration form adding date dialogbox how can apply validation in system date in dialog ends
Posted
by narasimha
on Stack Overflow
See other posts from Stack Overflow
or by narasimha
Published on 2010-05-20T12:01:31Z
Indexed on
2010/05/21
7:50 UTC
Read the original article
Hit count: 292
android
hi i am implementing registration form adding date field then click icon to display date dialog window then limit date validation in system date below date only how can implement the validation
protected Dialog onCreateDialog(int id) {
Calendar c = Calendar.getInstance();
int cyear = c.get(Calendar.YEAR);
int cmonth = c.get(Calendar.MONTH);
int cday = c.get(Calendar.DAY_OF_MONTH);
switch (id) {
case DATE_DIALOG_ID:
return new DatePickerDialog(this, mDateSetListener, cyear, cmonth, cday);
}
return null;
}
private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener()
{
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth)
{
String date_selected = String.valueOf(monthOfYear+1)+" /"+String.valueOf(dayOfMonth)+" /"+String.valueOf(year);
EditText birthday=(EditText) findViewById(R.id.EditTextBirthday);
birthday.setText(date_selected);
}
};
public void onClick(View v)
{
if(v == b1)
showDialog(DATE_DIALOG_ID);
}
}
**
showing in system date in below dates only how can implemented
some solution in running year to below years are display not incrementing above years this condition are appliying validations how can implemented ?
© Stack Overflow or respective owner