Skip to content

Most visited

Recently visited

navigation
Added in API level 1

Drawable.Callback

public static interface Drawable.Callback

android.graphics.drawable.Drawable.Callback
Known Indirect Subclasses


Implement this interface if you want to create an animated drawable that extends Drawable. Upon retrieving a drawable, use setCallback(android.graphics.drawable.Drawable.Callback) to supply your implementation of the interface to the drawable; it uses this interface to schedule and execute animation changes.

Summary

Public methods

abstract void invalidateDrawable(Drawable who)

Called when the drawable needs to be redrawn.

abstract void scheduleDrawable(Drawable who, Runnable what, long when)

A Drawable can call this to schedule the next frame of its animation.

abstract void unscheduleDrawable(Drawable who, Runnable what)

A Drawable can call this to unschedule an action previously scheduled with scheduleDrawable(Drawable, Runnable, long).

Public methods

invalidateDrawable

Added in API level 1
void invalidateDrawable (Drawable who)

Called when the drawable needs to be redrawn. A view at this point should invalidate itself (or at least the part of itself where the drawable appears).

Parameters
who Drawable: The drawable that is requesting the update.

scheduleDrawable

Added in API level 1
void scheduleDrawable (Drawable who, 
                Runnable what, 
                long when)

A Drawable can call this to schedule the next frame of its animation. An implementation can generally simply call postAtTime(Runnable, Object, long) with the parameters (what, who, when) to perform the scheduling.

Parameters
who Drawable: The drawable being scheduled.
what Runnable: The action to execute.
when long: The time (in milliseconds) to run. The timebase is uptimeMillis()

unscheduleDrawable

Added in API level 1
void unscheduleDrawable (Drawable who, 
                Runnable what)

A Drawable can call this to unschedule an action previously scheduled with scheduleDrawable(Drawable, Runnable, long). An implementation can generally simply call removeCallbacks(Runnable, Object) with the parameters (what, who) to unschedule the drawable.

Parameters
who Drawable: The drawable being unscheduled.
what Runnable: The action being unscheduled.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.