How do I validate the date as the date of birth? Not being able to put the date in the future.
data.addTextChangedListener(DateUtils.insert("##/##/####", data));
mData = data.getText().toString();
How do I validate the date as the date of birth? Not being able to put the date in the future.
data.addTextChangedListener(DateUtils.insert("##/##/####", data));
mData = data.getText().toString();
You can try something like this:
String dataDigitadaStr = editText.getText().toString(); // Ex: "04/05/2010"
SimpleDateFormat formater = new SimpleDateFormat("dd/MM/yyyy");
Date dataDigitada= formater.parse(dataDigitadaStr);
if(dataDigitada.getTime() >= Date.now()){
Toast.makeText(this, "Data digitada maior que a data atual", Toast.LENGTH_SHORT).show();
}