Advertisement
Sketchware

Verifica se CPF TEM 14 NÚMEROS POR CAUSA DA FORMATAÇÃO

Jan 13th, 2023
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. EditText cpfeditText = (EditText) findViewById(R.id.cpf_edit_text);
  2. InputFilter[] cpfFilters = {new InputFilter() {
  3.     @Override
  4.     public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
  5.         if (dest.length() == 14) {
  6.             Toast.makeText(HomeActivity.this, "Limite de caracteres atingido DO CPF ", Toast.LENGTH_SHORT).show();
  7.             return "";
  8.         }
  9.         return null;
  10.     }
  11. }};
  12. cpfeditText.setFilters(cpfFilters);
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement