Validation allow only number and characters in edit text in android

后端 未结 9 1410
抹茶落季
抹茶落季 2020-11-27 16:20

In my application I have to validate the EditText. It should only allow character, digits, underscores, and hyphens.

Here is my code:

edit         


        
9条回答
  •  粉色の甜心
    2020-11-27 17:10

    use this 2 function

    public static boolean isdigit(EditText input)
        {
    
        String data=input.getText().toString().trim();
        for(int i=0;i

    pass Edittext variable in these function .. so you can have boolean value.

提交回复
热议问题