> 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
class FakeBitmapLoader : BitmapLoader
```

<br />

*** ** * ** ***

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

## Summary

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

| ### Public functions |
|---|---|
| `open ListenableFuture<Bitmap>` | `decodeBitmap(data: ByteArray)` Decodes an image from compressed binary data. |
| `open ListenableFuture<Bitmap>` | `loadBitmap(uri: Uri)` Loads an image from `uri`. |
| `open Boolean` | `supportsMimeType(mimeType: String)` Returns whether the given `mimeType` is supported. |

| ### Public properties |
|---|---|
| `Int` | `decodeBitmapCallCount` The number of times `decodeBitmap` has been called. |
| `Int` | `loadBitmapCallCount` The number of times `loadBitmap` has been called. |

### Inherited functions

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

Loads an image from `MediaMetadata`.

## Public constructors

### FakeBitmapLoader

```
FakeBitmapLoader(bitmap: Bitmap)
```

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

### FakeBitmapLoader

```
FakeBitmapLoader(result: ListenableFuture<Bitmap>)
```

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

### FakeBitmapLoader

```
FakeBitmapLoader(throwable: Throwable)
```

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

## Public functions

### decodeBitmap

```
open fun decodeBitmap(data: ByteArray): ListenableFuture<Bitmap>
```

Decodes an image from compressed binary data.

### loadBitmap

```
open fun loadBitmap(uri: Uri): ListenableFuture<Bitmap>
```

Loads an image from `uri`.

### supportsMimeType

```
open fun supportsMimeType(mimeType: String): Boolean
```

Returns whether the given `mimeType` is supported.

## Public properties

### decodeBitmapCallCount

```
val decodeBitmapCallCount: Int
```

The number of times `decodeBitmap` has been called.

### loadBitmapCallCount

```
val loadBitmapCallCount: Int
```

The number of times `loadBitmap` has been called.