# FilenameFilter

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

# FilenameFilter

`
public


interface
FilenameFilter
`  
`


`

|------------------------|
| java.io.FilenameFilter |

<br />

*** ** * ** ***

Instances of classes that implement this interface are used to filter filenames. These instances are used to filter directory listings in the`list`method of class`File`, and by the Abstract Window Toolkit's file dialog component.  
**See also:**

- [File](https://developer.android.com/reference/java/io/File)
- [File.list(java.io.FilenameFilter)](https://developer.android.com/reference/java/io/File#list(java.io.FilenameFilter))

## Summary

|                                                                                                                                                                    ### Public methods                                                                                                                                                                    ||
|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract boolean` | ` `[accept](https://developer.android.com/reference/java/io/FilenameFilter#accept(java.io.File,%20java.lang.String))`(`[File](https://developer.android.com/reference/java/io/File)` dir, `[String](https://developer.android.com/reference/java/lang/String)` name) ` Tests if a specified file should be included in a file list. |

## Public methods

### accept

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract boolean accept (File dir, 
                String name)
```

Tests if a specified file should be included in a file list.

<br />

|                            Parameters                             ||
|--------|-----------------------------------------------------------|
| `dir`  | `File`: the directory in which the file was found. <br /> |
| `name` | `String`: the name of the file. <br />                    |

|                                                Returns                                                ||
|-----------|--------------------------------------------------------------------------------------------|
| `boolean` | `true`if and only if the name should be included in the file list;`false`otherwise. <br /> |