> Documentation index: https://developer.android.com/reference/llms.txt

# FakeBitmapLoader

Artifact: [androidx.media3:media3-test-utils](https://developer.android.com/jetpack/androidx/releases/media3.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/FakeBitmapLoader.kt+class:androidx.media3.test.utils.FakeBitmapLoader)

*** ** * ** ***


```
@UnstableApi
public final class FakeBitmapLoader implements BitmapLoader
```

<br />

*** ** * ** ***

A fake `BitmapLoader` that returns `result` for every `decodeBitmap` and `loadBitmap` call, and counts the calls.

## Summary

| ### Public constructors |
|---|
| `FakeBitmapLoader(@NonNull Bitmap bitmap)` Creates an instance that returns `bitmap` for every call. |
| `FakeBitmapLoader(@NonNull ListenableFuture<@NonNull Bitmap> result)` |
| `FakeBitmapLoader(@NonNull Throwable throwable)` Creates an instance that fails with `throwable` for every call. |

| ### Public methods |
|---|---|
| `@NonNull ListenableFuture<@NonNull Bitmap>` | `decodeBitmap(@NonNull byte[] data)` Decodes an image from compressed binary data. |
| `final int` | `getDecodeBitmapCallCount()` The number of times `decodeBitmap` has been called. |
| `final int` | `getLoadBitmapCallCount()` The number of times `loadBitmap` has been called. |
| `@NonNull ListenableFuture<@NonNull Bitmap>` | `loadBitmap(@NonNull Uri uri)` Loads an image from `uri`. |
| `boolean` | `supportsMimeType(@NonNull String mimeType)` Returns whether the given `mimeType` is supported. |

### Inherited methods

From [androidx.media3.common.util.BitmapLoader](https://developer.android.com/reference/androidx/media3/common/util/BitmapLoader.md.txt) `@Nullable ListenableFuture<@NonNull Bitmap>` `loadBitmapFromMetadata(@NonNull MediaMetadata metadata)`

Loads an image from `MediaMetadata`.

## Public constructors

### FakeBitmapLoader

```
public FakeBitmapLoader(@NonNull Bitmap bitmap)
```

Creates an instance that returns `bitmap` for every call.

### FakeBitmapLoader

```
public FakeBitmapLoader(@NonNull ListenableFuture<@NonNull Bitmap> result)
```

| Parameters |
|---|---|
| `@NonNull ListenableFuture<@NonNull Bitmap> result` | The result returned for every call. |

### FakeBitmapLoader

```
public FakeBitmapLoader(@NonNull Throwable throwable)
```

Creates an instance that fails with `throwable` for every call.

## Public methods

### decodeBitmap

```
public @NonNull ListenableFuture<@NonNull Bitmap> decodeBitmap(@NonNull byte[] data)
```

Decodes an image from compressed binary data.

### getDecodeBitmapCallCount

```
public final int getDecodeBitmapCallCount()
```

The number of times `decodeBitmap` has been called.

### getLoadBitmapCallCount

```
public final int getLoadBitmapCallCount()
```

The number of times `loadBitmap` has been called.

### loadBitmap

```
public @NonNull ListenableFuture<@NonNull Bitmap> loadBitmap(@NonNull Uri uri)
```

Loads an image from `uri`.

### supportsMimeType

```
public boolean supportsMimeType(@NonNull String mimeType)
```

Returns whether the given `mimeType` is supported.