SoFunction
Updated on 2025-03-02

Example of Java reflecting android r file


//Int value dynamically obtained through string-array name attribute
public CharSequence[] getListData(String name) {
        try {
            Class<?> arrayClass = getArrayResource().getClass();
            Field intField = (name);
            int sourceId = (name);
            return getResources().getTextArray(sourceId);
        } catch (Exception e) {
            ();
        }
        return null;
    }

private Object arrayResource = null;

private Object getArrayResource() {
        if (arrayResource == null) {
            Class<?> resource = ;
            try {
                Class<?>[] classes = ();
                for (Class<?> c : classes) {
                    int i = ();
                    String className = ();
                    String s = (i);
                    if (("static") && ("array")) {
                        return ().newInstance();
                    } else {
                        continue;
                    }
                }
            } catch (Exception e) {
                ();
            }
        }
        return arrayResource;
    }