@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (savedInstanceState != null) {
            Log.d(TAG, "Restoring selections in onCreate: "
                    + "position: " + savedInstanceState.getInt(SELECTED_LIST_POSITION, 0)
                    + "class: " + savedInstanceState.getString(SELECTED_APP_CLASS)
            );
            currentPosition = savedInstanceState.getInt(SELECTED_LIST_POSITION, 0);
            currentSelection = savedInstanceState.getString(SELECTED_APP_CLASS);
            enableMouseEvents = savedInstanceState.getBoolean(ENABLE_MOUSE_EVENTS, true);
            enableJoystickEvents = savedInstanceState.getBoolean(ENABLE_JOYSTICK_EVENTS, false);
            enableKeyEvents = savedInstanceState.getBoolean(ENABLE_KEY_EVENTS, true);
            verboseLogging = savedInstanceState.getBoolean(VERBOSE_LOGGING, true);
        }


        /* Set content view and register views */
        setContentView(R.layout.test_chooser_layout);
        btnOK = (Button) findViewById(R.id.btnOK);
        btnCancel = (Button) findViewById(R.id.btnCancel);
        listClasses = (ListView) findViewById(R.id.listClasses);
        editFilterText = (EditText) findViewById(R.id.txtFilter);


        /* Define the root package to start with */
        rootPackage = "jme3test";

        /* Create an array of Strings to define which classes to exclude */
        exclusions.add("$");  // inner classes
        exclusions.add("TestChooser");  // Desktop test chooser class
        exclusions.add("awt");  // Desktop test chooser class

//        mExclusions.add("");

        /*
         * Read the class names from the dex file and filter based on
         * name and super class.
         */

        Log.d(TAG, "Composing Test list...");

        ApplicationInfo ai = this.getApplicationInfo();
        String classPath = ai.sourceDir;
        DexFile dex = null;
        Enumeration<String> apkClassNames = null;
        try {
            dex = new DexFile(classPath);
            apkClassNames = dex.entries();
            while (apkClassNames.hasMoreElements()) {
                String className = apkClassNames.nextElement();
                if (checkClassName(className) && checkClassType(className)) {
                    classNames.add(className);
                }
//            	classNames.add(className);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                dex.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        /*
         * Create a backing Adapter for the List View from a list of the
         * classes. The list is defined by array of class names.
         */
        arrayAdapter = new CustomArrayAdapter(
                this,
                R.layout.test_chooser_row, // text view to display selection
                classNames // array of strings to display
        );

        /* Set the resource id for selected and non selected backgrounds */
        Log.d(TAG, "Setting Adapter Background Resource IDs");
        arrayAdapter.setSelectedBackgroundResource(R.drawable.selected);
        arrayAdapter.setNonSelectedBackgroundResource(R.drawable.nonselected);

        /* Attach the Adapter to the spinner */
        Log.d(TAG, "Setting ListView Adapter");
        listClasses.setAdapter(arrayAdapter);

        /* Set initial selection for the list */
        setSelection(currentPosition);

        /* Set Click and Text Changed listeners */
        listClasses.setOnItemClickListener(this);
        btnOK.setOnClickListener(this);
        btnCancel.setOnClickListener(this);
        editFilterText.addTextChangedListener(this);

    }
Called when the activity is first created.
jme3-android-examples/src/main/java/org/jmonkeyengine/jme3androidexamples/MainActivity.java