# CameraFilter

Artifact: [androidx.camera:camera-core](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/core/CameraFilter.java+class:androidx.camera.core.CameraFilter) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/camera#1.0.0)

*** ** * ** ***


```
public interface CameraFilter
```

<br />

*** ** * ** ***

An interface for filtering cameras.

## Summary

| ### Public methods |
|---|---|
| `abstract @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/camera/core/CameraInfo>` | `https://developer.android.com/reference/androidx/camera/core/CameraFilter#filter(java.util.List<androidx.camera.core.CameraInfo>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/camera/core/CameraInfo> cameraInfos)` Filters a list of `https://developer.android.com/reference/androidx/camera/core/CameraInfo`s and returns those matching the requirements. |

## Public methods

### filter

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/camera#1.0.0)

```
abstract @NonNull List<CameraInfo> filter(@NonNull List<CameraInfo> cameraInfos)
```

Filters a list of `https://developer.android.com/reference/androidx/camera/core/CameraInfo`s and returns those matching the requirements.

If the output list contains CameraInfos not in the input list, when used by a `https://developer.android.com/reference/androidx/camera/core/CameraSelector` then it will result in an IllegalArgumentException thrown when calling bindToLifecycle.

The CameraInfo that has lower index in the list has higher priority. When used by `https://developer.android.com/reference/androidx/camera/core/CameraSelector.Builder#addCameraFilter(androidx.camera.core.CameraFilter)`, the available cameras will be filtered by all `https://developer.android.com/reference/androidx/camera/core/CameraFilter`s by the order they were added. The first camera in the result will be selected if there are multiple cameras left.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/camera/core/CameraInfo> cameraInfos` | An unmodifiable list of `https://developer.android.com/reference/androidx/camera/core/CameraInfo`s being filtered. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/camera/core/CameraInfo>` | The output list of `https://developer.android.com/reference/androidx/camera/core/CameraInfo`s that match the requirements. Users are expected to create a new list to return with. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If the device cannot return a valid lens facing value, it will throw this exception. |