DefaultAndroidImageResourceByResIdResolver

public class DefaultAndroidImageResourceByResIdResolver implements ResourceResolvers.AndroidImageResourceByResIdResolver


Resource resolver for Android resources.

Summary

Public constructors

Constructor.

Public methods

@Override @NonNull ListenableFuture<@NonNull Drawable>

Get the drawable as specified by {@code resource}.

@NonNull @Override Drawable

Should immediately return the drawable specified by {@code resource}.

Public constructors

DefaultAndroidImageResourceByResIdResolver

public DefaultAndroidImageResourceByResIdResolver(
    @NonNull Resources androidResources
)

Constructor.

Parameters
@NonNull Resources androidResources

An Android Resources instance for the tile service's package. This is normally obtained from {@code PackageManager#getResourcesForApplication}.

Public methods

getDrawable

@Override
@NonNull
public @Override ListenableFuture<@NonNull DrawablegetDrawable(@NonNull ResourceProto.AndroidImageResourceByResId resource)

Get the drawable as specified by {@code resource}.

getDrawableOrThrow

@NonNull
@Override
public @Override Drawable getDrawableOrThrow(
    @NonNull ResourceProto.AndroidImageResourceByResId resource
)

Should immediately return the drawable specified by {@code resource}.

Throws
androidx.wear.tiles.renderer.internal.ResourceResolvers.ResourceAccessException

If the drawable cannot be found, or has to be loaded asynchronously.