android edittext inputfilter should accept space,character & number

試著忘記壹切 提交于 2019-12-06 05:24:59

instead of '||' i replaced with '&&' and got the answer....

!Character.isLetterOrDigit(source.charAt(i)) || Character.isSpaceChar(source.charAt(i))

Is the code you want assuming you DONT want white space characters and only numbers or characters.

Use this condition

for (int i = start; i < end; i++) { 
    if (!Character.isLetterOrDigit(source.charAt(i))) {
        if (!Character.isSpaceChar(source.charAt(i)))
            return "";
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!