public
class
ValueAnimator
extends Animator
java.lang.Object | ||
↳ | android.animation.Animator | |
↳ | android.animation.ValueAnimator |
Known Direct Subclasses |
This class provides a simple timing engine for running animations which calculate animated values and set them on target objects.
There is a single timing pulse that all animations use. It runs in a custom handler to ensure that property changes happen on the UI thread.
By default, ValueAnimator uses non-linear time interpolation, via the
AccelerateDecelerateInterpolator
class, which accelerates into and decelerates
out of an animation. This behavior can be changed by calling
setInterpolator(TimeInterpolator)
.
Animators can be created from either code or resource files. Here is an example of a ValueAnimator resource file:
<animator xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1000" android:valueFrom="1" android:valueTo="0" android:valueType="floatType" android:repeatCount="1" android:repeatMode="reverse"/>
It is also possible to use a combination of PropertyValuesHolder
and
Keyframe
resource tags to create a multi-step animation.
Note that you can specify explicit fractional values (from 0 to 1) for
each keyframe to determine when, in the overall duration, the animation should arrive at that
value. Alternatively, you can leave the fractions off and the keyframes will be equally
distributed within the total duration:
<animator xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1000" android:repeatCount="1" android:repeatMode="reverse"> <propertyValuesHolder> <keyframe android:fraction="0" android:value="1"/> <keyframe android:fraction=".2" android:value=".4"/> <keyframe android:fraction="1" android:value="0"/> </propertyValuesHolder> </animator>
For more information about animating with ValueAnimator
, read the
Property
Animation developer guide.
Nested classes | |
---|---|
interface |
ValueAnimator.AnimatorUpdateListener
Implementors of this interface can add themselves as update listeners
to an |
Constants | |
---|---|
int |
INFINITE
This value used used with the |
int |
RESTART
When the animation reaches the end and |
int |
REVERSE
When the animation reaches the end and |
Inherited constants |
---|
From
class
android.animation.Animator
|
Public constructors | |
---|---|
ValueAnimator()
Creates a new ValueAnimator object. |
Public methods | |
---|---|
void
|
addUpdateListener(ValueAnimator.AnimatorUpdateListener listener)
Adds a listener to the set of listeners that are sent update events through the life of an animation. |
void
|
cancel()
Cancels the animation. |
ValueAnimator
|
clone()
Creates and returns a copy of this object. |
void
|
end()
Ends the animation. |
float
|
getAnimatedFraction()
Returns the current animation fraction, which is the elapsed/interpolated fraction used in the most recent frame update on the animation. |
Object
|
getAnimatedValue()
The most recent value calculated by this |
Object
|
getAnimatedValue(String propertyName)
The most recent value calculated by this |
long
|
getCurrentPlayTime()
Gets the current position of the animation in time, which is equal to the current time minus the time that the animation started. |
long
|
getDuration()
Gets the length of the animation. |
static
long
|
getFrameDelay()
The amount of time, in milliseconds, between each frame of the animation. |
TimeInterpolator
|
getInterpolator()
Returns the timing interpolator that this ValueAnimator uses. |
int
|
getRepeatCount()
Defines how many times the animation should repeat. |
int
|
getRepeatMode()
Defines what this animation should do when it reaches the end. |
long
|
getStartDelay()
The amount of time, in milliseconds, to delay starting the animation after
|
long
|
getTotalDuration()
Gets the total duration of the animation, accounting for animation sequences, start delay, and repeating. |
PropertyValuesHolder[]
|
getValues()
Returns the values that this ValueAnimator animates between. |
boolean
|
isRunning()
Returns whether this Animator is currently running (having been started and gone past any initial startDelay period and not yet ended). |
boolean
|
isStarted()
Returns whether this Animator has been started and not yet ended. |
static
ValueAnimator
|
ofArgb(int... values)
Constructs and returns a ValueAnimator that animates between color values. |
static
ValueAnimator
|
ofFloat(float... values)
Constructs and returns a ValueAnimator that animates between float values. |
static
ValueAnimator
|
ofInt(int... values)
Constructs and returns a ValueAnimator that animates between int values. |
static
ValueAnimator
|
ofObject(TypeEvaluator evaluator, Object... values)
Constructs and returns a ValueAnimator that animates between Object values. |
static
ValueAnimator
|
ofPropertyValuesHolder(PropertyValuesHolder... values)
Constructs and returns a ValueAnimator that animates between the values specified in the PropertyValuesHolder objects. |
void
|
pause()
Pauses a running animation. |
void
|
removeAllUpdateListeners()
Removes all listeners from the set listening to frame updates for this animation. |
void
|
removeUpdateListener(ValueAnimator.AnimatorUpdateListener listener)
Removes a listener from the set listening to frame updates for this animation. |
void
|
resume()
Resumes a paused animation, causing the animator to pick up where it left off when it was paused. |
void
|
reverse()
Plays the ValueAnimator in reverse. |
void
|
setCurrentFraction(float fraction)
Sets the position of the animation to the specified fraction. |
void
|
setCurrentPlayTime(long playTime)
Sets the position of the animation to the specified point in time. |
ValueAnimator
|
setDuration(long duration)
Sets the length of the animation. |
void
|
setEvaluator(TypeEvaluator value)
The type evaluator to be used when calculating the animated values of this animation. |
void
|
setFloatValues(float... values)
Sets float values that will be animated between. |
static
void
|
setFrameDelay(long frameDelay)
The amount of time, in milliseconds, between each frame of the animation. |
void
|
setIntValues(int... values)
Sets int values that will be animated between. |
void
|
setInterpolator(TimeInterpolator value)
The time interpolator used in calculating the elapsed fraction of this animation. |
void
|
setObjectValues(Object... values)
Sets the values to animate between for this animation. |
void
|
setRepeatCount(int value)
Sets how many times the animation should be repeated. |
void
|
setRepeatMode(int value)
Defines what this animation should do when it reaches the end. |
void
|
setStartDelay(long startDelay)
The amount of time, in milliseconds, to delay starting the animation after
|
void
|
setValues(PropertyValuesHolder... values)
Sets the values, per property, being animated between. |
void
|
start()
Starts this animation. |
String
|
toString()
Returns a string representation of the object. |
Inherited methods | |
---|---|
From
class
android.animation.Animator
| |
From
class
java.lang.Object
|
int INFINITE
This value used used with the setRepeatCount(int)
property to repeat
the animation indefinitely.
Constant Value: -1 (0xffffffff)
int RESTART
When the animation reaches the end and repeatCount
is INFINITE
or a positive value, the animation restarts from the beginning.
Constant Value: 1 (0x00000001)
int REVERSE
When the animation reaches the end and repeatCount
is INFINITE
or a positive value, the animation reverses direction on every iteration.
Constant Value: 2 (0x00000002)
ValueAnimator ()
Creates a new ValueAnimator object. This default constructor is primarily for use internally; the factory methods which take parameters are more generally useful.
void addUpdateListener (ValueAnimator.AnimatorUpdateListener listener)
Adds a listener to the set of listeners that are sent update events through the life of an animation. This method is called on all listeners for every frame of the animation, after the values for the animation have been calculated.
Parameters | |
---|---|
listener |
ValueAnimator.AnimatorUpdateListener :
the listener to be added to the current set of listeners for this animation.
|
void cancel ()
Cancels the animation. Unlike end()
, cancel()
causes the animation to
stop in its tracks, sending an
onAnimationCancel(Animator)
to
its listeners, followed by an
onAnimationEnd(Animator)
message.
This method must be called on the thread that is running the animation.
ValueAnimator clone ()
Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object x
, the expression:
will be true, and that the expression:x.clone() != x
will bex.clone().getClass() == x.getClass()
true
, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x)
true
, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
super.clone
. If a class and all of its superclasses (except
Object
) obey this convention, it will be the case that
x.clone().getClass() == x.getClass()
.
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by super.clone
before returning it. Typically, this means
copying any mutable objects that comprise the internal "deep structure"
of the object being cloned and replacing the references to these
objects with references to the copies. If a class contains only
primitive fields or references to immutable objects, then it is usually
the case that no fields in the object returned by super.clone
need to be modified.
The method clone
for class Object
performs a
specific cloning operation. First, if the class of this object does
not implement the interface Cloneable
, then a
CloneNotSupportedException
is thrown. Note that all arrays
are considered to implement the interface Cloneable
and that
the return type of the clone
method of an array type T[]
is T[]
where T is any reference or primitive type.
Otherwise, this method creates a new instance of the class of this
object and initializes all its fields with exactly the contents of
the corresponding fields of this object, as if by assignment; the
contents of the fields are not themselves cloned. Thus, this method
performs a "shallow copy" of this object, not a "deep copy" operation.
The class Object
does not itself implement the interface
Cloneable
, so calling the clone
method on an object
whose class is Object
will result in throwing an
exception at run time.
Returns | |
---|---|
ValueAnimator |
a clone of this instance. |
void end ()
Ends the animation. This causes the animation to assign the end value of the property being
animated, then calling the
onAnimationEnd(Animator)
method on
its listeners.
This method must be called on the thread that is running the animation.
float getAnimatedFraction ()
Returns the current animation fraction, which is the elapsed/interpolated fraction used in the most recent frame update on the animation.
Returns | |
---|---|
float |
Elapsed/interpolated fraction of the animation. |
Object getAnimatedValue ()
The most recent value calculated by this ValueAnimator
when there is just one
property being animated. This value is only sensible while the animation is running. The main
purpose for this read-only property is to retrieve the value from the ValueAnimator
during a call to onAnimationUpdate(ValueAnimator)
, which
is called during each animation frame, immediately after the value is calculated.
Returns | |
---|---|
Object |
animatedValue The value most recently calculated by this ValueAnimator for
the single property being animated. If there are several properties being animated
(specified by several PropertyValuesHolder objects in the constructor), this function
returns the animated value for the first of those objects.
|
Object getAnimatedValue (String propertyName)
The most recent value calculated by this ValueAnimator
for propertyName
.
The main purpose for this read-only property is to retrieve the value from the
ValueAnimator
during a call to
onAnimationUpdate(ValueAnimator)
, which
is called during each animation frame, immediately after the value is calculated.
Parameters | |
---|---|
propertyName |
String
|
Returns | |
---|---|
Object |
animatedValue The value most recently calculated for the named property
by this ValueAnimator .
|
long getCurrentPlayTime ()
Gets the current position of the animation in time, which is equal to the current
time minus the time that the animation started. An animation that is not yet started will
return a value of zero, unless the animation has has its play time set via
setCurrentPlayTime(long)
or setCurrentFraction(float)
, in which case
it will return the time that was set.
Returns | |
---|---|
long |
The current position in time of the animation. |
long getDuration ()
Gets the length of the animation. The default duration is 300 milliseconds.
Returns | |
---|---|
long |
The length of the animation, in milliseconds. |
long getFrameDelay ()
The amount of time, in milliseconds, between each frame of the animation. This is a
requested time that the animation will attempt to honor, but the actual delay between
frames may be different, depending on system load and capabilities. This is a static
function because the same delay will be applied to all animations, since they are all
run off of a single timing loop.
The frame delay may be ignored when the animation system uses an external timing
source, such as the display refresh rate (vsync), to govern animations.
Note that this method should be called from the same thread that start()
is
called in order to check the frame delay for that animation. A runtime exception will be
thrown if the calling thread does not have a Looper.
Returns | |
---|---|
long |
the requested time between frames, in milliseconds |
TimeInterpolator getInterpolator ()
Returns the timing interpolator that this ValueAnimator uses.
Returns | |
---|---|
TimeInterpolator |
The timing interpolator for this ValueAnimator. |
int getRepeatCount ()
Defines how many times the animation should repeat. The default value is 0.
Returns | |
---|---|
int |
the number of times the animation should repeat, or INFINITE
|
int getRepeatMode ()
Defines what this animation should do when it reaches the end.
Returns | |
---|---|
int |
either one of REVERSE or RESTART
|
long getStartDelay ()
The amount of time, in milliseconds, to delay starting the animation after
start()
is called.
Returns | |
---|---|
long |
the number of milliseconds to delay running the animation |
long getTotalDuration ()
Gets the total duration of the animation, accounting for animation sequences, start delay,
and repeating. Return DURATION_INFINITE
if the duration is infinite.
Returns | |
---|---|
long |
Total time an animation takes to finish, starting from the time start()
is called. DURATION_INFINITE will be returned if the animation or any
child animation repeats infinite times.
|
PropertyValuesHolder[] getValues ()
Returns the values that this ValueAnimator animates between. These values are stored in PropertyValuesHolder objects, even if the ValueAnimator was created with a simple list of value objects instead.
Returns | |
---|---|
PropertyValuesHolder[] |
PropertyValuesHolder[] An array of PropertyValuesHolder objects which hold the values, per property, that define the animation. |
boolean isRunning ()
Returns whether this Animator is currently running (having been started and gone past any initial startDelay period and not yet ended).
Returns | |
---|---|
boolean |
Whether the Animator is running. |
boolean isStarted ()
Returns whether this Animator has been started and not yet ended. For reusable
Animators (which most Animators are, apart from the one-shot animator produced by
createCircularReveal()
),
this state is a superset of isRunning()
, because an Animator with a
nonzero startDelay
will return true for isStarted()
during
the delay phase, whereas isRunning()
will return true only after the delay phase
is complete. Non-reusable animators will always return true after they have been
started, because they cannot return to a non-started state.
Returns | |
---|---|
boolean |
Whether the Animator has been started and not yet ended. |
ValueAnimator ofArgb (int... values)
Constructs and returns a ValueAnimator that animates between color values. A single value implies that that value is the one being animated to. However, this is not typically useful in a ValueAnimator object because there is no way for the object to determine the starting value for the animation (unlike ObjectAnimator, which can derive that value from the target object and property being animated). Therefore, there should typically be two or more values.
Parameters | |
---|---|
values |
int :
A set of values that the animation will animate between over time. |
Returns | |
---|---|
ValueAnimator |
A ValueAnimator object that is set up to animate between the given values. |
ValueAnimator ofFloat (float... values)
Constructs and returns a ValueAnimator that animates between float values. A single value implies that that value is the one being animated to. However, this is not typically useful in a ValueAnimator object because there is no way for the object to determine the starting value for the animation (unlike ObjectAnimator, which can derive that value from the target object and property being animated). Therefore, there should typically be two or more values.
Parameters | |
---|---|
values |
float :
A set of values that the animation will animate between over time. |
Returns | |
---|---|
ValueAnimator |
A ValueAnimator object that is set up to animate between the given values. |
ValueAnimator ofInt (int... values)
Constructs and returns a ValueAnimator that animates between int values. A single value implies that that value is the one being animated to. However, this is not typically useful in a ValueAnimator object because there is no way for the object to determine the starting value for the animation (unlike ObjectAnimator, which can derive that value from the target object and property being animated). Therefore, there should typically be two or more values.
Parameters | |
---|---|
values |
int :
A set of values that the animation will animate between over time. |
Returns | |
---|---|
ValueAnimator |
A ValueAnimator object that is set up to animate between the given values. |
ValueAnimator ofObject (TypeEvaluator evaluator, Object... values)
Constructs and returns a ValueAnimator that animates between Object values. A single value implies that that value is the one being animated to. However, this is not typically useful in a ValueAnimator object because there is no way for the object to determine the starting value for the animation (unlike ObjectAnimator, which can derive that value from the target object and property being animated). Therefore, there should typically be two or more values.
Note: The Object values are stored as references to the original objects, which means that changes to those objects after this method is called will affect the values on the animator. If the objects will be mutated externally after this method is called, callers should pass a copy of those objects instead.
Since ValueAnimator does not know how to animate between arbitrary Objects, this factory method also takes a TypeEvaluator object that the ValueAnimator will use to perform that interpolation.
Parameters | |
---|---|
evaluator |
TypeEvaluator :
A TypeEvaluator that will be called on each animation frame to
provide the ncessry interpolation between the Object values to derive the animated
value. |
values |
Object :
A set of values that the animation will animate between over time. |
Returns | |
---|---|
ValueAnimator |
A ValueAnimator object that is set up to animate between the given values. |
ValueAnimator ofPropertyValuesHolder (PropertyValuesHolder... values)
Constructs and returns a ValueAnimator that animates between the values specified in the PropertyValuesHolder objects.
Parameters | |
---|---|
values |
PropertyValuesHolder :
A set of PropertyValuesHolder objects whose values will be animated
between over time. |
Returns | |
---|---|
ValueAnimator |
A ValueAnimator object that is set up to animate between the given values. |
void pause ()
Pauses a running animation. This method should only be called on the same thread on
which the animation was started. If the animation has not yet been started
or has since ended, then the call is ignored. Paused
animations can be resumed by calling resume()
.
void removeAllUpdateListeners ()
Removes all listeners from the set listening to frame updates for this animation.
void removeUpdateListener (ValueAnimator.AnimatorUpdateListener listener)
Removes a listener from the set listening to frame updates for this animation.
Parameters | |
---|---|
listener |
ValueAnimator.AnimatorUpdateListener :
the listener to be removed from the current set of update listeners
for this animation.
|
void resume ()
Resumes a paused animation, causing the animator to pick up where it left off when it was paused. This method should only be called on the same thread on which the animation was started. Calls to resume() on an animator that is not currently paused will be ignored.
void reverse ()
Plays the ValueAnimator in reverse. If the animation is already running, it will stop itself and play backwards from the point reached when reverse was called. If the animation is not currently running, then it will start from the end and play backwards. This behavior is only set for the current animation; future playing of the animation will use the default behavior of playing forward.
void setCurrentFraction (float fraction)
Sets the position of the animation to the specified fraction. This fraction should
be between 0 and the total fraction of the animation, including any repetition. That is,
a fraction of 0 will position the animation at the beginning, a value of 1 at the end,
and a value of 2 at the end of a reversing animator that repeats once. If
the animation has not yet been started, then it will not advance forward after it is
set to this fraction; it will simply set the fraction to this value and perform any
appropriate actions based on that fraction. If the animation is already running, then
setCurrentFraction() will set the current fraction to this value and continue
playing from that point. Animator.AnimatorListener
events are not called
due to changing the fraction; those events are only processed while the animation
is running.
Parameters | |
---|---|
fraction |
float :
The fraction to which the animation is advanced or rewound. Values
outside the range of 0 to the maximum fraction for the animator will be clamped to
the correct range.
|
void setCurrentPlayTime (long playTime)
Sets the position of the animation to the specified point in time. This time should be between 0 and the total duration of the animation, including any repetition. If the animation has not yet been started, then it will not advance forward after it is set to this time; it will simply set the time to this value and perform any appropriate actions based on that time. If the animation is already running, then setCurrentPlayTime() will set the current playing time to this value and continue playing from that point.
Parameters | |
---|---|
playTime |
long :
The time, in milliseconds, to which the animation is advanced or rewound.
|
ValueAnimator setDuration (long duration)
Sets the length of the animation. The default duration is 300 milliseconds.
Parameters | |
---|---|
duration |
long :
The length of the animation, in milliseconds. This value cannot
be negative. |
Returns | |
---|---|
ValueAnimator |
ValueAnimator The object called with setDuration(). This return
value makes it easier to compose statements together that construct and then set the
duration, as in ValueAnimator.ofInt(0, 10).setDuration(500).start() .
|
void setEvaluator (TypeEvaluator value)
The type evaluator to be used when calculating the animated values of this animation.
The system will automatically assign a float or int evaluator based on the type
of startValue
and endValue
in the constructor. But if these values
are not one of these primitive types, or if different evaluation is desired (such as is
necessary with int values that represent colors), a custom evaluator needs to be assigned.
For example, when running an animation on color values, the ArgbEvaluator
should be used to get correct RGB color interpolation.
If this ValueAnimator has only one set of values being animated between, this evaluator will be used for that set. If there are several sets of values being animated, which is the case if PropertyValuesHolder objects were set on the ValueAnimator, then the evaluator is assigned just to the first PropertyValuesHolder object.
Parameters | |
---|---|
value |
TypeEvaluator :
the evaluator to be used this animation
|
void setFloatValues (float... values)
Sets float values that will be animated between. A single value implies that that value is the one being animated to. However, this is not typically useful in a ValueAnimator object because there is no way for the object to determine the starting value for the animation (unlike ObjectAnimator, which can derive that value from the target object and property being animated). Therefore, there should typically be two or more values.
If there are already multiple sets of values defined for this ValueAnimator via more than one PropertyValuesHolder object, this method will set the values for the first of those objects.
Parameters | |
---|---|
values |
float :
A set of values that the animation will animate between over time.
|
void setFrameDelay (long frameDelay)
The amount of time, in milliseconds, between each frame of the animation. This is a
requested time that the animation will attempt to honor, but the actual delay between
frames may be different, depending on system load and capabilities. This is a static
function because the same delay will be applied to all animations, since they are all
run off of a single timing loop.
The frame delay may be ignored when the animation system uses an external timing
source, such as the display refresh rate (vsync), to govern animations.
Note that this method should be called from the same thread that start()
is
called in order to have the new frame delay take effect on that animation. A runtime
exception will be thrown if the calling thread does not have a Looper.
Parameters | |
---|---|
frameDelay |
long :
the requested time between frames, in milliseconds
|
void setIntValues (int... values)
Sets int values that will be animated between. A single value implies that that value is the one being animated to. However, this is not typically useful in a ValueAnimator object because there is no way for the object to determine the starting value for the animation (unlike ObjectAnimator, which can derive that value from the target object and property being animated). Therefore, there should typically be two or more values.
If there are already multiple sets of values defined for this ValueAnimator via more than one PropertyValuesHolder object, this method will set the values for the first of those objects.
Parameters | |
---|---|
values |
int :
A set of values that the animation will animate between over time.
|
void setInterpolator (TimeInterpolator value)
The time interpolator used in calculating the elapsed fraction of this animation. The
interpolator determines whether the animation runs with linear or non-linear motion,
such as acceleration and deceleration. The default value is
AccelerateDecelerateInterpolator
Parameters | |
---|---|
value |
TimeInterpolator :
the interpolator to be used by this animation. A value of null
will result in linear interpolation.
|
void setObjectValues (Object... values)
Sets the values to animate between for this animation. A single value implies that that value is the one being animated to. However, this is not typically useful in a ValueAnimator object because there is no way for the object to determine the starting value for the animation (unlike ObjectAnimator, which can derive that value from the target object and property being animated). Therefore, there should typically be two or more values.
Note: The Object values are stored as references to the original objects, which means that changes to those objects after this method is called will affect the values on the animator. If the objects will be mutated externally after this method is called, callers should pass a copy of those objects instead.
If there are already multiple sets of values defined for this ValueAnimator via more than one PropertyValuesHolder object, this method will set the values for the first of those objects.
There should be a TypeEvaluator set on the ValueAnimator that knows how to interpolate between these value objects. ValueAnimator only knows how to interpolate between the primitive types specified in the other setValues() methods.
Parameters | |
---|---|
values |
Object :
The set of values to animate between.
|
void setRepeatCount (int value)
Sets how many times the animation should be repeated. If the repeat
count is 0, the animation is never repeated. If the repeat count is
greater than 0 or INFINITE
, the repeat mode will be taken
into account. The repeat count is 0 by default.
Parameters | |
---|---|
value |
int :
the number of times the animation should be repeated
|
void setRepeatMode (int value)
Defines what this animation should do when it reaches the end. This
setting is applied only when the repeat count is either greater than
0 or INFINITE
. Defaults to RESTART
.
Parameters | |
---|---|
value |
int :
RESTART or REVERSE
|
void setStartDelay (long startDelay)
The amount of time, in milliseconds, to delay starting the animation after
start()
is called. Note that the start delay should always be non-negative. Any
negative start delay will be clamped to 0 on N and above.
Parameters | |
---|---|
startDelay |
long :
The amount of the delay, in milliseconds
|
void setValues (PropertyValuesHolder... values)
Sets the values, per property, being animated between. This function is called internally by the constructors of ValueAnimator that take a list of values. But a ValueAnimator can be constructed without values and this method can be called to set the values manually instead.
Parameters | |
---|---|
values |
PropertyValuesHolder :
The set of values, per property, being animated between.
|
void start ()
Starts this animation. If the animation has a nonzero startDelay, the animation will start
running after that delay elapses. A non-delayed animation will have its initial
value(s) set immediately, followed by calls to
onAnimationStart(Animator)
for any listeners of this animator.
The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.
String toString ()
Returns a string representation of the object. In general, the
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
Returns | |
---|---|
String |
a string representation of the object. |