Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EditText edittext5 = (EditText) findViewById(R.id.edittext5);
- InputFilter[] filters = {new InputFilter.LengthFilter(1), new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
- if (!source.toString().equals("1")) {
- Toast.makeText(HomeActivity.this, "Somente o número 1 é permitido", Toast.LENGTH_SHORT).show();
- return "";
- }
- return null;
- }
- }};
- edittext5.setFilters(filters);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement