Question: I´m writing an application that relies on Ajax requests to retrieve data from a dataBase, the required info is delivered in a Json set of objects, this means that even for the empty fields of the dataBase a pair of propriety/value is generated:

```
[{"field1":"value1","field2":"value2","field3":""},{"field1":"","field2":"","field3":""}]

```

How can I Select only not empty fields from the dataBase via SQL avoiding generating and sending unnecessary data?

Answer: 
```
public void walkdir(File dir) {
    String pdfPattern = ".pdf";

    File[] listFile = dir.listFiles();

    if (listFile != null) {
        for (int i = 0; i < listFile.length; i++) {

            if (listFile[i].isDirectory()) {
                walkdir(listFile[i]);
            } else {
              if (listFile[i].getName().endsWith(pdfPattern)){
                              //Do what ever u want

              }
            }
        }
    }    }

```

To search on the whole sdcard call this function using`walkdir(Environment.getExternalStorageDirectory());`
You can use this code:  

here is the [link](http://programondaspot.blogspot.com/2015/07/display-more-than-one-extension-files.html).

```
/**
  * Class to filter files which are having .mp3 extension
  * */
//you can choose the filter for me i put .mp3
class FileExtensionFilter implements FilenameFilter {
    public boolean accept(File dir, String name) {
        return (name.endsWith(".pdf" ) || name.endsWith(".docs" )) || name.endsWith(".3gp" ) ;
    }
}

```