Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.text.InputFilter;

import android.widget.EditText;

import java.util.ArrayList;
import java.util.Arrays;

public class Main {
    public static void setAllCapsInputFilter(EditText et) {
        InputFilter[] prefFilters;
        prefFilters = et.getFilters();
        ArrayList<InputFilter> filters = new ArrayList<>(Arrays.asList(prefFilters));
        filters.add(new InputFilter.AllCaps());
        prefFilters = new InputFilter[filters.size()];
        filters.toArray(prefFilters);
        et.setFilters(prefFilters);
    }
}