androidandroid-edittextandroid-filter

Android Auto Tab to next EditText


How do you set editText that are created dynamically to auto tab to the next one when you use a InputFilter to limit the number of characters? (created inside a for loop)

        editTextView.setInputType(InputType.TYPE_CLASS_NUMBER);
        editTextView.setBackgroundColor(Color.BLACK);
        editTextView.setTextColor(Color.WHITE);
        editTextView.setHighlightColor(Color.GRAY);
        InputFilter[] filters = new InputFilter[1];
        filters[0] = new InputFilter.LengthFilter(2); //Filter to 10 characters
        editTextView.setFilters(filters);
        editTextView.setSelectAllOnFocus(true);

Solution

  • When the InputFilter crosses the limit for the number of characters add this

    editTextView.setImeOptions(EditorInfo.IME_ACTION_NEXT);