Asked  6 Months ago    Answers:  5   Viewed   52 times

I want to restrict the chars to 0-9, a-z, A-Z and spacebar only. Setting inputtype I can limit to digits but I cannot figure out the ways of Inputfilter looking through the docs.



I found this on another forum. Works like a champ.

InputFilter filter = new InputFilter() {
    public CharSequence filter(CharSequence source, int start, int end,
            Spanned dest, int dstart, int dend) {
        for (int i = start; i < end; i++) {
            if (!Character.isLetterOrDigit(source.charAt(i))) {
                return "";
        return null;
edit.setFilters(new InputFilter[] { filter });
Tuesday, June 1, 2021
answered 6 Months ago

From a note in the documentation:

$workbook->setVersion(8); // Use Excel97/2000 Format
$worksheet->writeString(0, 0, $str);
Wednesday, March 31, 2021
answered 9 Months ago

Actually the hint moves to the parent view TextInputLayout that surrounds the EditText view:

You can get the hint like this: parent = ( yourEditText.getParent();
String hint = parent.getHint().toString();

And if you want to add * make it like this:

parent.setHint(parent.getHint() + "*");

Happy codding! :)

Wednesday, August 4, 2021
answered 4 Months ago

I found this method from GridLayout:

So maybe you could try something like this:

((GridLayout.LayoutParams) this.getLayoutParams()).columnSpec =
    GridLayout.spec(GridLayout.UNDEFINED, 1f);
Friday, September 24, 2021
Georges Dupret
answered 2 Months ago

You are looking for TextWatcher:

    youredittext.addTextChangedListener(new TextWatcher()
        public void afterTextChanged(Editable mEdit) 
            text = mEdit.toString();

        public void beforeTextChanged(CharSequence s, int start, int count, int after){}

        public void onTextChanged(CharSequence s, int start, int before, int count){}
Saturday, October 9, 2021
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :