Android Open Source - isidore Drawable Preview Activity

From Project

Back to project page isidore.


The source code is released under:

GNU General Public License

If you think the Android project isidore listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.tbardici.isidore;
//from   w w  w . j  a v a 2  s.  c o  m
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.os.Bundle;
import android.util.Log;
import android.widget.SimpleAdapter;

public class DrawablePreviewActivity extends ListActivity
    private static final String TAG = "DrawablePreviewActivity";

    public void onCreate(Bundle savedInstanceState)

        setTitle("Preview of android.R.drawable.*");

        try {
            Class RClass = Class.forName("android.R");

            Class[] subclasses = RClass.getDeclaredClasses();

            Class RDrawable = null;

            for(Class subclass : subclasses) {
                if("android.R.drawable".equals(subclass.getCanonicalName())) {
                    RDrawable = subclass;

            List<Map<String, Object>> drinfo = new ArrayList<Map<String, Object>>();

            Field[] drawables = RDrawable.getFields();
            for(Field dr : drawables) {
                Map<String, Object> map = new HashMap<String, Object>();
                Drawable img = getResources().getDrawable(dr.getInt(null));

                map.put("drimg", dr.getInt(null));
                map.put("drname", dr.getName());


            setListAdapter(new SimpleAdapter(this,
                            new String[] { "drimg", "drname" },
                            new int[] {, }));

        } catch(IllegalAccessException iae) {
            Log.e(TAG, iae.toString());
        } catch(ClassNotFoundException cnfe) {
            Log.e(TAG, cnfe.toString());

Java Source Code List