generate Intent Filter List - Android Intent

Android examples for Intent:Intent Filter

Description

generate Intent Filter List

Demo Code


//package com.java2s;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;

import java.util.List;

public class Main {
    private final static List<String> generateIntentFilterList(Class<?> cls) {
        ArrayList<String> list = new ArrayList<String>();
        for (Field field : cls.getDeclaredFields())
            if (field.getType().equals(String.class)
                    && Modifier.isStatic(field.getModifiers())
                    && field.getName().startsWith("ACTION_"))
                try {
                    list.add((String) field.get(null));
                } catch (Exception e) {
                }/*from  w w  w .j av  a2  s  .  co m*/
        return list;
    }
}

Related Tutorials