2
How to validate the date as the date of birth? Can not put the date in the future.
data.addTextChangedListener(DateUtils.insert("##/##/####", data));
mData = data.getText().toString();
2
How to validate the date as the date of birth? Can not put the date in the future.
data.addTextChangedListener(DateUtils.insert("##/##/####", data));
mData = data.getText().toString();
0
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();
}
Browser other questions tagged java android
You are not signed in. Login or sign up in order to post.
Have you ever tried anything?
– Jéf Bueno
I don’t understand. You can explain it better?
– ramaral
In my registration screen the user will put the date of birth,I will pass the text written to string,the date that the user put can not be for example the year greater than 2017.. month greater than 12
– Thiago
Thank you for your attention..
– Thiago