Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/content/res/loader/ResourcesLoader#pubctors) \| [Methods](https://developer.android.com/reference/android/content/res/loader/ResourcesLoader#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/content/res/loader/ResourcesLoader#inhmethods)

# ResourcesLoader

*** ** * ** ***

` public class ResourcesLoader `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.content.res.loader.ResourcesLoader |

<br />

*** ** * ** ***

A container for supplying `https://developer.android.com/reference/android/content/res/loader/ResourcesProvider` to `https://developer.android.com/reference/android/content/res/Resources` objects.

`https://developer.android.com/reference/android/content/res/loader/ResourcesLoader` are added to Resources objects to supply additional resources and assets or modify the values of existing resources and assets. Multiple Resources objects can share the same ResourcesLoaders and ResourcesProviders. Changes to the list of `https://developer.android.com/reference/android/content/res/loader/ResourcesProvider` a loader contains propagates to all Resources objects that use the loader.

Loaders must be added to Resources objects in increasing precedence order. A loader will override the resources and assets of loaders added before itself.

Providers retrieved with `https://developer.android.com/reference/android/content/res/loader/ResourcesLoader#getProviders()` are listed in increasing precedence order. A provider will override the resources and assets of providers listed before itself.

Modifying the list of providers a loader contains or the list of loaders a Resources object contains can cause lock contention with the UI thread. APIs that modify the lists of loaders or providers should only be used on the UI thread. Providers can be instantiated on any thread without causing lock contention.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/content/res/loader/ResourcesLoader#ResourcesLoader()() ` |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/content/res/loader/ResourcesLoader#addProvider(android.content.res.loader.ResourcesProvider)(https://developer.android.com/reference/android/content/res/loader/ResourcesProvider resourcesProvider) ` Appends a provider to the end of the provider list. |
| ` void` | ` https://developer.android.com/reference/android/content/res/loader/ResourcesLoader#clearProviders()() ` Removes all `https://developer.android.com/reference/android/content/res/loader/ResourcesProvider`. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/res/loader/ResourcesProvider>` | ` https://developer.android.com/reference/android/content/res/loader/ResourcesLoader#getProviders()() ` Retrieves the list of providers loaded into this instance. |
| ` void` | ` https://developer.android.com/reference/android/content/res/loader/ResourcesLoader#removeProvider(android.content.res.loader.ResourcesProvider)(https://developer.android.com/reference/android/content/res/loader/ResourcesProvider resourcesProvider) ` Removes a provider from the provider list. |
| ` void` | ` https://developer.android.com/reference/android/content/res/loader/ResourcesLoader#setProviders(java.util.List<android.content.res.loader.ResourcesProvider>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/res/loader/ResourcesProvider> resourcesProviders) ` Sets the list of providers. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### ResourcesLoader

```
public ResourcesLoader ()
```

<br />

<br />

## Public methods

### addProvider

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

```
public void addProvider (ResourcesProvider resourcesProvider)
```

Appends a provider to the end of the provider list. If the provider is already present in the loader list, the list will not be modified.

This should only be called from the UI thread to avoid lock contention when propagating provider changes.

<br />

| Parameters ||
|---|---|
| `resourcesProvider` | `ResourcesProvider`: the provider to add. This value cannot be `null`. <br /> |

### clearProviders

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

```
public void clearProviders ()
```

Removes all `https://developer.android.com/reference/android/content/res/loader/ResourcesProvider`.

This should only be called from the UI thread to avoid lock contention when propagating provider changes.

<br />

### getProviders

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

```
public List<ResourcesProvider> getProviders ()
```

Retrieves the list of providers loaded into this instance. Providers are listed in increasing precedence order. A provider will override the values of providers listed before itself.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/res/loader/ResourcesProvider>` | This value cannot be `null`. <br /> |

### removeProvider

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

```
public void removeProvider (ResourcesProvider resourcesProvider)
```

Removes a provider from the provider list. If the provider is not present in the provider list, the list will not be modified.

This should only be called from the UI thread to avoid lock contention when propagating provider changes.

<br />

| Parameters ||
|---|---|
| `resourcesProvider` | `ResourcesProvider`: the provider to remove. This value cannot be `null`. <br /> |

### setProviders

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

```
public void setProviders (List<ResourcesProvider> resourcesProviders)
```

Sets the list of providers.

This should only be called from the UI thread to avoid lock contention when propagating provider changes.

<br />

| Parameters ||
|---|---|
| `resourcesProviders` | `List`: the new providers. This value cannot be `null`. <br /> |