public final class

MotionEvent

extends Object
implements Parcelable
java.lang.Object
   ↳ android.view.MotionEvent

Class Overview

Object used to report movement (mouse, pen, finger, trackball) events. This class may hold either absolute or relative movements, depending on what it is being used for.

Summary

Constants
int ACTION_CANCEL Constant for getAction(): The current gesture has been aborted.
int ACTION_DOWN Constant for getAction(): A pressed gesture has started, the motion contains the initial starting location.
int ACTION_MASK Bit mask of the parts of the action code that are the action itself.
int ACTION_MOVE Constant for getAction(): A change has happened during a press gesture (between ACTION_DOWN and ACTION_UP).
int ACTION_OUTSIDE Constant for getAction(): A movement has happened outside of the normal bounds of the UI element.
int ACTION_POINTER_1_DOWN Synonym for ACTION_POINTER_DOWN with ACTION_POINTER_ID_MASK of 0: the primary pointer has gone done.
int ACTION_POINTER_1_UP Synonym for ACTION_POINTER_UP with ACTION_POINTER_ID_MASK of 0: the primary pointer has gone up.
int ACTION_POINTER_2_DOWN Synonym for ACTION_POINTER_DOWN with ACTION_POINTER_ID_MASK of 1: the secondary pointer has gone done.
int ACTION_POINTER_2_UP Synonym for ACTION_POINTER_UP with ACTION_POINTER_ID_MASK of 1: the secondary pointer has gone up.
int ACTION_POINTER_3_DOWN Synonym for ACTION_POINTER_DOWN with ACTION_POINTER_ID_MASK of 2: the tertiary pointer has gone done.
int ACTION_POINTER_3_UP Synonym for ACTION_POINTER_UP with ACTION_POINTER_ID_MASK of 2: the tertiary pointer has gone up.
int ACTION_POINTER_DOWN A non-primary pointer has gone down.
int ACTION_POINTER_ID_MASK Bits in the action code that represent a pointer ID, used with ACTION_POINTER_DOWN and ACTION_POINTER_UP.
int ACTION_POINTER_ID_SHIFT Bit shift for the action bits holding the pointer identifier as defined by ACTION_POINTER_ID_MASK.
int ACTION_POINTER_UP A non-primary pointer has gone up.
int ACTION_UP Constant for getAction(): A pressed gesture has finished, the motion contains the final release location as well as any intermediate points since the last down or move event.
Creator<MotionEvent> CREATOR
int EDGE_BOTTOM Flag indicating the motion event intersected the bottom edge of the screen.
int EDGE_LEFT Flag indicating the motion event intersected the left edge of the screen.
int EDGE_RIGHT Flag indicating the motion event intersected the right edge of the screen.
int EDGE_TOP Flag indicating the motion event intersected the top edge of the screen.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Public Methods
final void addBatch(long eventTime, float x, float y, float pressure, float size, int metaState)
Add a new movement to the batch of movements in this event.
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
final int findPointerIndex(int pointerId)
Given a pointer identifier, find the index of its data in the event.
final int getAction()
Return the kind of action being performed -- one of either ACTION_DOWN, ACTION_MOVE, ACTION_UP, or ACTION_CANCEL.
final int getDeviceId()
Return the id for the device that this event came from.
final long getDownTime()
Returns the time (in ms) when the user originally pressed down to start a stream of position events.
final int getEdgeFlags()
Returns a bitfield indicating which edges, if any, where touched by this MotionEvent.
final long getEventTime()
Returns the time (in ms) when this specific event was generated.
final long getHistoricalEventTime(int pos)
Returns the time that a historical movement occurred between this event and the previous event.
final float getHistoricalPressure(int pointerIndex, int pos)
Returns a historical pressure coordinate, as per getPressure(int), that occurred between this event and the previous event for the given pointer.
final float getHistoricalPressure(int pos)
getHistoricalPressure(int) for the first pointer index (may be an arbitrary pointer identifier).
final float getHistoricalSize(int pos)
getHistoricalSize(int) for the first pointer index (may be an arbitrary pointer identifier).
final float getHistoricalSize(int pointerIndex, int pos)
Returns a historical size coordinate, as per getSize(int), that occurred between this event and the previous event for the given pointer.
final float getHistoricalX(int pos)
getHistoricalX(int) for the first pointer index (may be an arbitrary pointer identifier).
final float getHistoricalX(int pointerIndex, int pos)
Returns a historical X coordinate, as per getX(int), that occurred between this event and the previous event for the given pointer.
final float getHistoricalY(int pointerIndex, int pos)
Returns a historical Y coordinate, as per getY(int), that occurred between this event and the previous event for the given pointer.
final float getHistoricalY(int pos)
getHistoricalY(int) for the first pointer index (may be an arbitrary pointer identifier).
final int getHistorySize()
Returns the number of historical points in this event.
final int getMetaState()
Returns the state of any meta / modifier keys that were in effect when the event was generated.
final int getPointerCount()
The number of pointers of data contained in this event.
final int getPointerId(int pointerIndex)
Return the pointer identifier associated with a particular pointer data index is this event.
final float getPressure()
getPressure(int) for the first pointer index (may be an arbitrary pointer identifier).
final float getPressure(int pointerIndex)
Returns the current pressure of this event for the given pointer index (use getPointerId(int) to find the pointer identifier for this index).
final float getRawX()
Returns the original raw X coordinate of this event.
final float getRawY()
Returns the original raw Y coordinate of this event.
final float getSize()
getSize(int) for the first pointer index (may be an arbitrary pointer identifier).
final float getSize(int pointerIndex)
Returns a scaled value of the approximate size for the given pointer index (use getPointerId(int) to find the pointer identifier for this index).
final float getX()
getX(int) for the first pointer index (may be an arbitrary pointer identifier).
final float getX(int pointerIndex)
Returns the X coordinate of this event for the given pointer index (use getPointerId(int) to find the pointer identifier for this index).
final float getXPrecision()
Return the precision of the X coordinates being reported.
final float getY(int pointerIndex)
Returns the Y coordinate of this event for the given pointer index (use getPointerId(int) to find the pointer identifier for this index).
final float getY()
getY(int) for the first pointer index (may be an arbitrary pointer identifier).
final float getYPrecision()
Return the precision of the Y coordinates being reported.
static MotionEvent obtain(MotionEvent o)
Create a new MotionEvent, copying from an existing one.
static MotionEvent obtain(long downTime, long eventTime, int action, float x, float y, int metaState)
Create a new MotionEvent, filling in a subset of the basic motion values.
static MotionEvent obtain(long downTime, long eventTime, int action, float x, float y, float pressure, float size, int metaState, float xPrecision, float yPrecision, int deviceId, int edgeFlags)
Create a new MotionEvent, filling in all of the basic values that define the motion.
static MotionEvent obtain(long downTime, long eventTime, int action, int pointers, float x, float y, float pressure, float size, int metaState, float xPrecision, float yPrecision, int deviceId, int edgeFlags)
Create a new MotionEvent, filling in all of the basic values that define the motion.
static MotionEvent obtainNoHistory(MotionEvent o)
Create a new MotionEvent, copying from an existing one, but not including any historical point information.
final void offsetLocation(float deltaX, float deltaY)
Adjust this event's location.
void recycle()
Recycle the MotionEvent, to be re-used by a later caller.
final void setAction(int action)
Sets this event's action.
final void setEdgeFlags(int flags)
Sets the bitfield indicating which edges, if any, where touched by this MotionEvent.
final void setLocation(float x, float y)
Set this event's location.
String toString()
Returns a string containing a concise, human-readable description of this object.
void writeToParcel(Parcel out, int flags)
Flatten this object in to a Parcel.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final int ACTION_CANCEL

Since: API Level 1

Constant for getAction(): The current gesture has been aborted. You will not receive any more points in it. You should treat this as an up event, but not perform any action that you normally would.

Constant Value: 3 (0x00000003)

public static final int ACTION_DOWN

Since: API Level 1

Constant for getAction(): A pressed gesture has started, the motion contains the initial starting location.

Constant Value: 0 (0x00000000)

public static final int ACTION_MASK

Since: API Level 5

Bit mask of the parts of the action code that are the action itself.

Constant Value: 255 (0x000000ff)

public static final int ACTION_MOVE

Since: API Level 1

Constant for getAction(): A change has happened during a press gesture (between ACTION_DOWN and ACTION_UP). The motion contains the most recent point, as well as any intermediate points since the last down or move event.

Constant Value: 2 (0x00000002)

public static final int ACTION_OUTSIDE

Since: API Level 3

Constant for getAction(): A movement has happened outside of the normal bounds of the UI element. This does not provide a full gesture, but only the initial location of the movement/touch.

Constant Value: 4 (0x00000004)

public static final int ACTION_POINTER_1_DOWN

Since: API Level 5

Synonym for ACTION_POINTER_DOWN with ACTION_POINTER_ID_MASK of 0: the primary pointer has gone done.

Constant Value: 5 (0x00000005)

public static final int ACTION_POINTER_1_UP

Since: API Level 5

Synonym for ACTION_POINTER_UP with ACTION_POINTER_ID_MASK of 0: the primary pointer has gone up.

Constant Value: 6 (0x00000006)

public static final int ACTION_POINTER_2_DOWN

Since: API Level 5

Synonym for ACTION_POINTER_DOWN with ACTION_POINTER_ID_MASK of 1: the secondary pointer has gone done.

Constant Value: 261 (0x00000105)

public static final int ACTION_POINTER_2_UP

Since: API Level 5

Synonym for ACTION_POINTER_UP with ACTION_POINTER_ID_MASK of 1: the secondary pointer has gone up.

Constant Value: 262 (0x00000106)

public static final int ACTION_POINTER_3_DOWN

Since: API Level 5

Synonym for ACTION_POINTER_DOWN with ACTION_POINTER_ID_MASK of 2: the tertiary pointer has gone done.

Constant Value: 517 (0x00000205)

public static final int ACTION_POINTER_3_UP

Since: API Level 5

Synonym for ACTION_POINTER_UP with ACTION_POINTER_ID_MASK of 2: the tertiary pointer has gone up.

Constant Value: 518 (0x00000206)

public static final int ACTION_POINTER_DOWN

Since: API Level 5

A non-primary pointer has gone down. The bits in ACTION_POINTER_ID_MASK indicate which pointer changed.

Constant Value: 5 (0x00000005)

public static final int ACTION_POINTER_ID_MASK

Since: API Level 5

Bits in the action code that represent a pointer ID, used with ACTION_POINTER_DOWN and ACTION_POINTER_UP. Pointer IDs start at 0, with 0 being the primary (first) pointer in the motion. Note that this not not an index into the array of pointer values, which is compacted to only contain pointers that are down; the pointer ID for a particular index can be found with findPointerIndex(int).

Constant Value: 65280 (0x0000ff00)

public static final int ACTION_POINTER_ID_SHIFT

Since: API Level 5

Bit shift for the action bits holding the pointer identifier as defined by ACTION_POINTER_ID_MASK.

Constant Value: 8 (0x00000008)

public static final int ACTION_POINTER_UP

Since: API Level 5

A non-primary pointer has gone up. The bits in ACTION_POINTER_ID_MASK indicate which pointer changed.

Constant Value: 6 (0x00000006)

public static final int ACTION_UP

Since: API Level 1

Constant for getAction(): A pressed gesture has finished, the motion contains the final release location as well as any intermediate points since the last down or move event.

Constant Value: 1 (0x00000001)

public static final Creator<MotionEvent> CREATOR

Since: API Level 1

public static final int EDGE_BOTTOM

Since: API Level 1

Flag indicating the motion event intersected the bottom edge of the screen.

Constant Value: 2 (0x00000002)

public static final int EDGE_LEFT

Since: API Level 1

Flag indicating the motion event intersected the left edge of the screen.

Constant Value: 4 (0x00000004)

public static final int EDGE_RIGHT

Since: API Level 1

Flag indicating the motion event intersected the right edge of the screen.

Constant Value: 8 (0x00000008)

public static final int EDGE_TOP

Since: API Level 1

Flag indicating the motion event intersected the top edge of the screen.

Constant Value: 1 (0x00000001)

Public Methods

public final void addBatch (long eventTime, float x, float y, float pressure, float size, int metaState)

Since: API Level 1

Add a new movement to the batch of movements in this event. The event's current location, position and size is updated to the new values. In the future, the current values in the event will be added to a list of historic values.

Parameters
eventTime The time stamp for this data.
x The new X position.
y The new Y position.
pressure The new pressure.
size The new size.
metaState Meta key state.

public int describeContents ()

Since: API Level 1

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public final int findPointerIndex (int pointerId)

Since: API Level 5

Given a pointer identifier, find the index of its data in the event.

Parameters
pointerId The identifier of the pointer to be found.
Returns
  • Returns either the index of the pointer (for use with {@link #getX(int) et al.), or -1 if there is no data available for that pointer identifier.

public final int getAction ()

Since: API Level 1

Return the kind of action being performed -- one of either ACTION_DOWN, ACTION_MOVE, ACTION_UP, or ACTION_CANCEL.

public final int getDeviceId ()

Since: API Level 1

Return the id for the device that this event came from. An id of zero indicates that the event didn't come from a physical device; other numbers are arbitrary and you shouldn't depend on the values.

public final long getDownTime ()

Since: API Level 1

Returns the time (in ms) when the user originally pressed down to start a stream of position events.

public final int getEdgeFlags ()

Since: API Level 1

Returns a bitfield indicating which edges, if any, where touched by this MotionEvent. For touch events, clients can use this to determine if the user's finger was touching the edge of the display.

public final long getEventTime ()

Since: API Level 1

Returns the time (in ms) when this specific event was generated.

public final long getHistoricalEventTime (int pos)

Since: API Level 1

Returns the time that a historical movement occurred between this event and the previous event. Only applies to ACTION_MOVE events.

Parameters
pos Which historical value to return; must be less than getHistorySize()

public final float getHistoricalPressure (int pointerIndex, int pos)

Since: API Level 5

Returns a historical pressure coordinate, as per getPressure(int), that occurred between this event and the previous event for the given pointer. Only applies to ACTION_MOVE events.

Parameters
pointerIndex Raw index of pointer to retrieve. Value may be from 0 (the first pointer that is down) to getPointerCount()-1.
pos Which historical value to return; must be less than getHistorySize()

public final float getHistoricalPressure (int pos)

Since: API Level 1

getHistoricalPressure(int) for the first pointer index (may be an arbitrary pointer identifier).

public final float getHistoricalSize (int pos)

Since: API Level 1

getHistoricalSize(int) for the first pointer index (may be an arbitrary pointer identifier).

public final float getHistoricalSize (int pointerIndex, int pos)

Since: API Level 5

Returns a historical size coordinate, as per getSize(int), that occurred between this event and the previous event for the given pointer. Only applies to ACTION_MOVE events.

Parameters
pointerIndex Raw index of pointer to retrieve. Value may be from 0 (the first pointer that is down) to getPointerCount()-1.
pos Which historical value to return; must be less than getHistorySize()

public final float getHistoricalX (int pos)

Since: API Level 1

getHistoricalX(int) for the first pointer index (may be an arbitrary pointer identifier).

public final float getHistoricalX (int pointerIndex, int pos)

Since: API Level 5

Returns a historical X coordinate, as per getX(int), that occurred between this event and the previous event for the given pointer. Only applies to ACTION_MOVE events.

Parameters
pointerIndex Raw index of pointer to retrieve. Value may be from 0 (the first pointer that is down) to getPointerCount()-1.
pos Which historical value to return; must be less than getHistorySize()

public final float getHistoricalY (int pointerIndex, int pos)

Since: API Level 5

Returns a historical Y coordinate, as per getY(int), that occurred between this event and the previous event for the given pointer. Only applies to ACTION_MOVE events.

Parameters
pointerIndex Raw index of pointer to retrieve. Value may be from 0 (the first pointer that is down) to getPointerCount()-1.
pos Which historical value to return; must be less than getHistorySize()

public final float getHistoricalY (int pos)

Since: API Level 1

getHistoricalY(int) for the first pointer index (may be an arbitrary pointer identifier).

public final int getHistorySize ()

Since: API Level 1

Returns the number of historical points in this event. These are movements that have occurred between this event and the previous event. This only applies to ACTION_MOVE events -- all other actions will have a size of 0.

Returns
  • Returns the number of historical points in the event.

public final int getMetaState ()

Since: API Level 1

Returns the state of any meta / modifier keys that were in effect when the event was generated. This is the same values as those returned by KeyEvent.getMetaState.

Returns
  • an integer in which each bit set to 1 represents a pressed meta key
See Also

public final int getPointerCount ()

Since: API Level 5

The number of pointers of data contained in this event. Always >= 1.

public final int getPointerId (int pointerIndex)

Since: API Level 5

Return the pointer identifier associated with a particular pointer data index is this event. The identifier tells you the actual pointer number associated with the data, accounting for individual pointers going up and down since the start of the current gesture.

Parameters
pointerIndex Raw index of pointer to retrieve. Value may be from 0 (the first pointer that is down) to getPointerCount()-1.

public final float getPressure ()

Since: API Level 1

getPressure(int) for the first pointer index (may be an arbitrary pointer identifier).

public final float getPressure (int pointerIndex)

Since: API Level 5

Returns the current pressure of this event for the given pointer index (use getPointerId(int) to find the pointer identifier for this index). The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), however values higher than 1 may be generated depending on the calibration of the input device.

Parameters
pointerIndex Raw index of pointer to retrieve. Value may be from 0 (the first pointer that is down) to getPointerCount()-1.

public final float getRawX ()

Since: API Level 1

Returns the original raw X coordinate of this event. For touch events on the screen, this is the original location of the event on the screen, before it had been adjusted for the containing window and views.

public final float getRawY ()

Since: API Level 1

Returns the original raw Y coordinate of this event. For touch events on the screen, this is the original location of the event on the screen, before it had been adjusted for the containing window and views.

public final float getSize ()

Since: API Level 1

getSize(int) for the first pointer index (may be an arbitrary pointer identifier).

public final float getSize (int pointerIndex)

Since: API Level 5

Returns a scaled value of the approximate size for the given pointer index (use getPointerId(int) to find the pointer identifier for this index). This represents some approximation of the area of the screen being pressed; the actual value in pixels corresponding to the touch is normalized with the device specific range of values and scaled to a value between 0 and 1. The value of size can be used to determine fat touch events.

Parameters
pointerIndex Raw index of pointer to retrieve. Value may be from 0 (the first pointer that is down) to getPointerCount()-1.

public final float getX ()

Since: API Level 1

getX(int) for the first pointer index (may be an arbitrary pointer identifier).

public final float getX (int pointerIndex)

Since: API Level 5

Returns the X coordinate of this event for the given pointer index (use getPointerId(int) to find the pointer identifier for this index). Whole numbers are pixels; the value may have a fraction for input devices that are sub-pixel precise.

Parameters
pointerIndex Raw index of pointer to retrieve. Value may be from 0 (the first pointer that is down) to getPointerCount()-1.

public final float getXPrecision ()

Since: API Level 1

Return the precision of the X coordinates being reported. You can multiple this number with getX() to find the actual hardware value of the X coordinate.

Returns
  • Returns the precision of X coordinates being reported.

public final float getY (int pointerIndex)

Since: API Level 5

Returns the Y coordinate of this event for the given pointer index (use getPointerId(int) to find the pointer identifier for this index). Whole numbers are pixels; the value may have a fraction for input devices that are sub-pixel precise.

Parameters
pointerIndex Raw index of pointer to retrieve. Value may be from 0 (the first pointer that is down) to getPointerCount()-1.

public final float getY ()

Since: API Level 1

getY(int) for the first pointer index (may be an arbitrary pointer identifier).

public final float getYPrecision ()

Since: API Level 1

Return the precision of the Y coordinates being reported. You can multiple this number with getY() to find the actual hardware value of the Y coordinate.

Returns
  • Returns the precision of Y coordinates being reported.

public static MotionEvent obtain (MotionEvent o)

Since: API Level 1

Create a new MotionEvent, copying from an existing one.

public static MotionEvent obtain (long downTime, long eventTime, int action, float x, float y, int metaState)

Since: API Level 1

Create a new MotionEvent, filling in a subset of the basic motion values. Those not specified here are: device id (always 0), pressure and size (always 1), x and y precision (always 1), and edgeFlags (always 0).

Parameters
downTime The time (in ms) when the user originally pressed down to start a stream of position events. This must be obtained from uptimeMillis().
eventTime The the time (in ms) when this specific event was generated. This must be obtained from uptimeMillis().
action The kind of action being performed -- one of either ACTION_DOWN, ACTION_MOVE, ACTION_UP, or ACTION_CANCEL.
x The X coordinate of this event.
y The Y coordinate of this event.
metaState The state of any meta / modifier keys that were in effect when the event was generated.

public static MotionEvent obtain (long downTime, long eventTime, int action, float x, float y, float pressure, float size, int metaState, float xPrecision, float yPrecision, int deviceId, int edgeFlags)

Since: API Level 1

Create a new MotionEvent, filling in all of the basic values that define the motion.

Parameters
downTime The time (in ms) when the user originally pressed down to start a stream of position events. This must be obtained from uptimeMillis().
eventTime The the time (in ms) when this specific event was generated. This must be obtained from uptimeMillis().
action The kind of action being performed -- one of either ACTION_DOWN, ACTION_MOVE, ACTION_UP, or ACTION_CANCEL.
x The X coordinate of this event.
y The Y coordinate of this event.
pressure The current pressure of this event. The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), however values higher than 1 may be generated depending on the calibration of the input device.
size A scaled value of the approximate size of the area being pressed when touched with the finger. The actual value in pixels corresponding to the finger touch is normalized with a device specific range of values and scaled to a value between 0 and 1.
metaState The state of any meta / modifier keys that were in effect when the event was generated.
xPrecision The precision of the X coordinate being reported.
yPrecision The precision of the Y coordinate being reported.
deviceId The id for the device that this event came from. An id of zero indicates that the event didn't come from a physical device; other numbers are arbitrary and you shouldn't depend on the values.
edgeFlags A bitfield indicating which edges, if any, where touched by this MotionEvent.

public static MotionEvent obtain (long downTime, long eventTime, int action, int pointers, float x, float y, float pressure, float size, int metaState, float xPrecision, float yPrecision, int deviceId, int edgeFlags)

Since: API Level 5

Create a new MotionEvent, filling in all of the basic values that define the motion.

Parameters
downTime The time (in ms) when the user originally pressed down to start a stream of position events. This must be obtained from uptimeMillis().
eventTime The the time (in ms) when this specific event was generated. This must be obtained from uptimeMillis().
action The kind of action being performed -- one of either ACTION_DOWN, ACTION_MOVE, ACTION_UP, or ACTION_CANCEL.
pointers The number of pointers that are active in this event.
x The X coordinate of this event.
y The Y coordinate of this event.
pressure The current pressure of this event. The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), however values higher than 1 may be generated depending on the calibration of the input device.
size A scaled value of the approximate size of the area being pressed when touched with the finger. The actual value in pixels corresponding to the finger touch is normalized with a device specific range of values and scaled to a value between 0 and 1.
metaState The state of any meta / modifier keys that were in effect when the event was generated.
xPrecision The precision of the X coordinate being reported.
yPrecision The precision of the Y coordinate being reported.
deviceId The id for the device that this event came from. An id of zero indicates that the event didn't come from a physical device; other numbers are arbitrary and you shouldn't depend on the values.
edgeFlags A bitfield indicating which edges, if any, where touched by this MotionEvent.

public static MotionEvent obtainNoHistory (MotionEvent o)

Since: API Level 5

Create a new MotionEvent, copying from an existing one, but not including any historical point information.

public final void offsetLocation (float deltaX, float deltaY)

Since: API Level 1

Adjust this event's location.

Parameters
deltaX Amount to add to the current X coordinate of the event.
deltaY Amount to add to the current Y coordinate of the event.

public void recycle ()

Since: API Level 1

Recycle the MotionEvent, to be re-used by a later caller. After calling this function you must not ever touch the event again.

public final void setAction (int action)

Since: API Level 1

Sets this event's action.

public final void setEdgeFlags (int flags)

Since: API Level 1

Sets the bitfield indicating which edges, if any, where touched by this MotionEvent.

See Also

public final void setLocation (float x, float y)

Since: API Level 1

Set this event's location. Applies offsetLocation(float, float) with a delta from the current location to the given new location.

Parameters
x New absolute X location.
y New absolute Y location.

public String toString ()

Since: API Level 1

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation simply concatenates the class name, the '@' sign and a hexadecimal representation of the object's hashCode(), that is, it is equivalent to the following expression:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
  • a printable representation of this object.

public void writeToParcel (Parcel out, int flags)

Since: API Level 1

Flatten this object in to a Parcel.

Parameters
out The Parcel in which the object should be written.
flags Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.