I want to filter files stored in my phone with the .apk extension. I have tried the below code but it filters files found only in **sdcard/file.apk**
but I want it to filter the file by searching into the sub directories of sdcard also.

For example if there is an apk file inside **sdcard/download/mm.apk** it should filter it and also if there is another file in **sdcard/New Folder/ABC/cc.apk** it should filter it too.

How can I do that? thank you for your help...

```
ExtFilter apkFilter = new ExtFilter("apk");
            File file[] =Environment.getExternalStorageDirectory().listFiles(apkFilter);
            Log.i("InstallApk","Filter applied. Size: "+ file.length);
            for (int i=0; i < file.length; i++)
                {
                    Log.i("InstallApk",
                          "FileName:" + file[i].getName());
                }
            ArrayAdapter af=new ArrayAdapter<File>(this,android.R.layout.simple_list_item_1,android.R.id.text1,file);
            ListView ll=(ListView) findViewById(R.id.mainListView1);
            ll.setAdapter(af);
        }
    class ExtFilter implements
    FilenameFilter {       
    String ext;        
    public ExtFilter(String ext) {     
    this.ext = "." + ext;        
    }       
    public boolean accept(File dir, String name) 
    {            
    return name.endsWith(ext);      
    }
        }

```