Code example for IntentFilter

Methods: addAction, addDataScheme

0
            onPackageChanged(); 
        } 
    }; 
 
    private final InputMethodManager mImm;
    private final IntentFilter mIntentFilter = new IntentFilter();
    private final HashMap<View, Pair<InputMethodInfo, InputMethodSubtype>> mRadioViewAndImiMap =
            new HashMap<View, Pair<InputMethodInfo, InputMethodSubtype>>();
    private final TreeMap<InputMethodInfo, List<InputMethodSubtype>>
            mEnabledInputMethodAndSubtypesCache =
                    new TreeMap<InputMethodInfo, List<InputMethodSubtype>>(
                            new InputMethodComparator()); 
 
    private boolean mAttached = false;
    private boolean mPackageChanged = false;
    private Context mContext;
    private IBinder mToken;
    private InputMethodButton mInputMethodSwitchButton;
    private LinearLayout mInputMethodMenuList;
    private boolean mHardKeyboardAvailable;
    private boolean mHardKeyboardEnabled;
    private OnHardKeyboardEnabledChangeListener mHardKeyboardEnabledChangeListener;
    private LinearLayout mHardKeyboardSection;
    private Switch mHardKeyboardSwitch;
    private PackageManager mPackageManager;
    private String mEnabledInputMethodAndSubtypesCacheStr;
    private String mLastSystemLocaleString;
    private View mConfigureImeShortcut;
 
    private class InputMethodComparator implements Comparator<InputMethodInfo> {
        @Override 
        public int compare(InputMethodInfo imi1, InputMethodInfo imi2) {
            if (imi2 == null) return 0;
            if (imi1 == null) return 1;
            if (mPackageManager == null) {
                return imi1.getId().compareTo(imi2.getId());
            } 
            CharSequence imiId1 = imi1.loadLabel(mPackageManager) + "/" + imi1.getId();
            CharSequence imiId2 = imi2.loadLabel(mPackageManager) + "/" + imi2.getId();
            return imiId1.toString().compareTo(imiId2.toString());
        } 
    } 
 
    public InputMethodsPanel(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    } 
 
    public InputMethodsPanel(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        mContext = context;
        mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
        mIntentFilter.addAction(Intent.ACTION_PACKAGE_REPLACED);
        mIntentFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
        mIntentFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
        mIntentFilter.addDataScheme("package");
    } 
 
    public void setHardKeyboardEnabledChangeListener( 
            OnHardKeyboardEnabledChangeListener listener) {
        mHardKeyboardEnabledChangeListener = listener;