Code example for ListView

Methods: getItemAtPosition

0
        data.add(temp);
    } 
 
    protected void onListItemClick(ListView l, View v, int position, long id)
    { 
        Map map = (Map) l.getItemAtPosition(position);
        final String path = (String)map.get("path");
 
        if ((new File(path)).isDirectory()) {
            final CharSequence[] items = {"Open", "Run"};
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle("Select an Action");
            builder.setSingleChoiceItems(items, -1,
                    new DialogInterface.OnClickListener(){
                public void onClick(DialogInterface dialog, int which) {
                    switch (which) {
                        case OPEN_DIRECTORY:
                            dialog.dismiss();
                            mPath = path;
                            mFocusFile = null;
                            updateList();