PointerIcon
  public
  
  final
  
  class
  PointerIcon
  
    extends Object
  
  
  
  
  
      implements
      
        Parcelable
      
  
  
| java.lang.Object | |
| ↳ | android.view.PointerIcon | 
Represents an icon that can be used as a mouse pointer.
Pointer icons can be provided either by the system using system types, or by applications using bitmaps or application resources.
Summary
| Constants | |
|---|---|
| int | TYPE_ALIASType constant: alias (indicating an alias of/shortcut to something is to be created. | 
| int | TYPE_ALL_SCROLLType constant: all-scroll. | 
| int | TYPE_ARROWType constant: Arrow icon. | 
| int | TYPE_CELLType constant: cell. | 
| int | TYPE_CONTEXT_MENUType constant: context-menu. | 
| int | TYPE_COPYType constant: copy. | 
| int | TYPE_CROSSHAIRType constant: crosshair. | 
| int | TYPE_DEFAULT
      This constant was deprecated
      in API level 35.
    This is the same as using  | 
| int | TYPE_GRABType constant: grab. | 
| int | TYPE_GRABBINGType constant: grabbing. | 
| int | TYPE_HANDType constant: hand. | 
| int | TYPE_HANDWRITINGType constant: handwriting. | 
| int | TYPE_HELPType constant: help. | 
| int | TYPE_HORIZONTAL_DOUBLE_ARROWType constant: horizontal double arrow mainly for resizing. | 
| int | TYPE_NO_DROPType constant: no-drop. | 
| int | TYPE_NULLType constant: Null icon. | 
| int | TYPE_TEXTType constant: text. | 
| int | TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROWType constant: diagonal double arrow -- top-left to bottom-right. | 
| int | TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROWType constant: diagonal double arrow -- top-right to bottom-left. | 
| int | TYPE_VERTICAL_DOUBLE_ARROWType constant: vertical double arrow mainly for resizing. | 
| int | TYPE_VERTICAL_TEXTType constant: vertical-text. | 
| int | TYPE_WAITType constant: wait. | 
| int | TYPE_ZOOM_INType constant: zoom-in. | 
| int | TYPE_ZOOM_OUTType constant: zoom-out. | 
| Inherited constants | 
|---|
| Fields | |
|---|---|
| 
    public
    static
    final
    Creator<PointerIcon> | CREATOR
 | 
| Public methods | |
|---|---|
| 
        
        
        static
        
        
        PointerIcon | 
      create(Bitmap bitmap, float hotSpotX, float hotSpotY)
      Creates a custom pointer icon from the given bitmap and hotspot information. | 
| 
        
        
        
        
        
        int | 
      describeContents()
      Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. | 
| 
        
        
        
        
        
        boolean | 
      equals(Object other)
      Indicates whether some other object is "equal to" this one. | 
| 
        
        
        static
        
        
        PointerIcon | 
      getSystemIcon(Context context, int type)
      Gets a system pointer icon for the given type. | 
| 
        
        
        static
        
        
        PointerIcon | 
      load(Resources resources, int resourceId)
      Loads a custom pointer icon from an XML resource. | 
| 
        
        
        
        
        
        String | 
      toString()
      Returns a string representation of the object. | 
| 
        
        
        
        
        
        void | 
      writeToParcel(Parcel out, int flags)
      Flatten this object in to a Parcel. | 
| Inherited methods | |
|---|---|
Constants
TYPE_ALIAS
public static final int TYPE_ALIAS
Type constant: alias (indicating an alias of/shortcut to something is to be created.
Constant Value: 1010 (0x000003f2)
TYPE_ALL_SCROLL
public static final int TYPE_ALL_SCROLL
Type constant: all-scroll.
Constant Value: 1013 (0x000003f5)
TYPE_ARROW
public static final int TYPE_ARROW
Type constant: Arrow icon. (Default mouse pointer)
Constant Value: 1000 (0x000003e8)
TYPE_CELL
public static final int TYPE_CELL
Type constant: cell.
Constant Value: 1006 (0x000003ee)
TYPE_CONTEXT_MENU
public static final int TYPE_CONTEXT_MENU
Type constant: context-menu.
Constant Value: 1001 (0x000003e9)
TYPE_COPY
public static final int TYPE_COPY
Type constant: copy.
Constant Value: 1011 (0x000003f3)
TYPE_CROSSHAIR
public static final int TYPE_CROSSHAIR
Type constant: crosshair.
Constant Value: 1007 (0x000003ef)
TYPE_DEFAULT
public static final int TYPE_DEFAULT
      This constant was deprecated
      in API level 35.
    This is the same as using TYPE_ARROW. Use TYPE_ARROW to
     explicitly show an arrow, or use a null PointerIcon with
     View.setPointerIcon(PointerIcon) or
     View.onResolvePointerIcon(MotionEvent, int) instead to show
     the default pointer icon.
  
The default pointer icon.
Constant Value: 1000 (0x000003e8)
TYPE_GRAB
public static final int TYPE_GRAB
Type constant: grab.
Constant Value: 1020 (0x000003fc)
TYPE_GRABBING
public static final int TYPE_GRABBING
Type constant: grabbing.
Constant Value: 1021 (0x000003fd)
TYPE_HAND
public static final int TYPE_HAND
Type constant: hand.
Constant Value: 1002 (0x000003ea)
TYPE_HANDWRITING
public static final int TYPE_HANDWRITING
Type constant: handwriting.
Constant Value: 1022 (0x000003fe)
TYPE_HELP
public static final int TYPE_HELP
Type constant: help.
Constant Value: 1003 (0x000003eb)
TYPE_HORIZONTAL_DOUBLE_ARROW
public static final int TYPE_HORIZONTAL_DOUBLE_ARROW
Type constant: horizontal double arrow mainly for resizing.
Constant Value: 1014 (0x000003f6)
TYPE_NO_DROP
public static final int TYPE_NO_DROP
Type constant: no-drop.
Constant Value: 1012 (0x000003f4)
TYPE_NULL
public static final int TYPE_NULL
Type constant: Null icon. It has no bitmap.
Constant Value: 0 (0x00000000)
TYPE_TEXT
public static final int TYPE_TEXT
Type constant: text.
Constant Value: 1008 (0x000003f0)
TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW
public static final int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW
Type constant: diagonal double arrow -- top-left to bottom-right.
Constant Value: 1017 (0x000003f9)
TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW
public static final int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW
Type constant: diagonal double arrow -- top-right to bottom-left.
Constant Value: 1016 (0x000003f8)
TYPE_VERTICAL_DOUBLE_ARROW
public static final int TYPE_VERTICAL_DOUBLE_ARROW
Type constant: vertical double arrow mainly for resizing.
Constant Value: 1015 (0x000003f7)
TYPE_VERTICAL_TEXT
public static final int TYPE_VERTICAL_TEXT
Type constant: vertical-text.
Constant Value: 1009 (0x000003f1)
TYPE_WAIT
public static final int TYPE_WAIT
Type constant: wait.
Constant Value: 1004 (0x000003ec)
TYPE_ZOOM_IN
public static final int TYPE_ZOOM_IN
Type constant: zoom-in.
Constant Value: 1018 (0x000003fa)
TYPE_ZOOM_OUT
public static final int TYPE_ZOOM_OUT
Type constant: zoom-out.
Constant Value: 1019 (0x000003fb)
Fields
Public methods
create
public static PointerIcon create (Bitmap bitmap, float hotSpotX, float hotSpotY)
Creates a custom pointer icon from the given bitmap and hotspot information.
| Parameters | |
|---|---|
| bitmap | Bitmap: The bitmap for the icon.
 This value cannot benull. | 
| hotSpotX | float: The X offset of the pointer icon hotspot in the bitmap.
        Must be within the [0, bitmap.getWidth()) range. | 
| hotSpotY | float: The Y offset of the pointer icon hotspot in the bitmap.
        Must be within the [0, bitmap.getHeight()) range. | 
| Returns | |
|---|---|
| PointerIcon | A pointer icon for this bitmap.
 This value cannot be null. | 
| Throws | |
|---|---|
| IllegalArgumentException | if bitmap is null, or if the x/y hotspot parameters are invalid. | 
describeContents
public int describeContents ()
Describe the kinds of special objects contained in this Parcelable
 instance's marshaled representation. For example, if the object will
 include a file descriptor in the output of writeToParcel(android.os.Parcel, int),
 the return value of this method must include the
 CONTENTS_FILE_DESCRIPTOR bit.
| Returns | |
|---|---|
| int | a bitmask indicating the set of special object types marshaled
 by this Parcelable object instance.
 Value is either 0orCONTENTS_FILE_DESCRIPTOR | 
equals
public boolean equals (Object other)
Indicates whether some other object is "equal to" this one.
 The equals method implements an equivalence relation
 on non-null object references:
 
- It is reflexive: for any non-null reference value
     x,x.equals(x)should returntrue.
- It is symmetric: for any non-null reference values
     xandy,x.equals(y)should returntrueif and only ify.equals(x)returnstrue.
- It is transitive: for any non-null reference values
     x,y, andz, ifx.equals(y)returnstrueandy.equals(z)returnstrue, thenx.equals(z)should returntrue.
- It is consistent: for any non-null reference values
     xandy, multiple invocations ofx.equals(y)consistently returntrueor consistently returnfalse, provided no information used inequalscomparisons on the objects is modified.
- For any non-null reference value x,x.equals(null)should returnfalse.
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| Parameters | |
|---|---|
| other | Object: This value may benull. | 
| Returns | |
|---|---|
| boolean | trueif this object is the same as the obj
          argument;falseotherwise. | 
getSystemIcon
public static PointerIcon getSystemIcon (Context context, int type)
Gets a system pointer icon for the given type.
| Parameters | |
|---|---|
| context | Context: The context.
 This value cannot benull. | 
| type | int: The pointer icon type. | 
| Returns | |
|---|---|
| PointerIcon | The pointer icon.
 This value cannot be null. | 
| Throws | |
|---|---|
| IllegalArgumentException | if context is null. | 
load
public static PointerIcon load (Resources resources, int resourceId)
Loads a custom pointer icon from an XML resource.
 The XML resource should have the following form:
 
 <?xml version="1.0" encoding="utf-8"?>
 <pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
   android:bitmap="@drawable/my_pointer_bitmap"
   android:hotSpotX="24"
   android:hotSpotY="24" />
 
 
| Parameters | |
|---|---|
| resources | Resources: The resources object.
 This value cannot benull. | 
| resourceId | int: The resource id. | 
| Returns | |
|---|---|
| PointerIcon | The pointer icon.
 This value cannot be null. | 
| Throws | |
|---|---|
| IllegalArgumentException | if resources is null. | 
| Resources.NotFoundException | if the resource was not found or the drawable linked in the resource was not found. | 
toString
public String toString ()
Returns a string representation of the object.
| Returns | |
|---|---|
| String | a string representation of the object. | 
writeToParcel
public void writeToParcel (Parcel out, int flags)
Flatten this object in to a Parcel.
| Parameters | |
|---|---|
| out | Parcel: The Parcel in which the object should be written.
 This value cannot benull. | 
| flags | int: Additional flags about how the object should be written.
 May be 0 orParcelable.PARCELABLE_WRITE_RETURN_VALUE.
 Value is either0or a combination ofParcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES | 
