# PointerIconCompat

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/view/PointerIconCompat.java+class:androidx.core.view.PointerIconCompat) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***


```
public final class PointerIconCompat
```

<br />

*** ** * ** ***

Helper for accessing features in `https://developer.android.com/reference/android/view/PointerIcon.html` in a backwards compatible fashion.

## Summary

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_ALIAS() = 1010` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_ALIAS` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_ALL_SCROLL() = 1013` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_ALL_SCROLL` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_ARROW() = 1000` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_ARROW` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_CELL() = 1006` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_CELL` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_CONTEXT_MENU() = 1001` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_CONTEXT_MENU` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_COPY() = 1011` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_COPY` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_CROSSHAIR() = 1007` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_CROSSHAIR` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_DEFAULT() = 1000` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_DEFAULT` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_GRAB() = 1020` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_GRAB` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_GRABBING() = 1021` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_GRABBING` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_HAND() = 1002` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_HAND` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_HELP() = 1003` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_HELP` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_HORIZONTAL_DOUBLE_ARROW() = 1014` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_HORIZONTAL_DOUBLE_ARROW` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_NO_DROP() = 1012` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_NO_DROP` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_NULL() = 0` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_NULL` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_TEXT() = 1008` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_TEXT` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW() = 1017` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW() = 1016` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_VERTICAL_DOUBLE_ARROW() = 1015` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_VERTICAL_DOUBLE_ARROW` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_VERTICAL_TEXT() = 1009` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_VERTICAL_TEXT` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_WAIT() = 1004` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_WAIT` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_ZOOM_IN() = 1018` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_ZOOM_IN` |
| `static final int` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#TYPE_ZOOM_OUT() = 1019` Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_ZOOM_OUT` |

| ### Public methods |
|---|---|
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/view/PointerIconCompat` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#create(android.graphics.Bitmap,float,float)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Bitmap.html bitmap, float hotSpotX, float hotSpotY)` Creates a custom pointer from the given bitmap and hotspot information. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/view/PointerIconCompat` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#getSystemIcon(android.content.Context,int)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, int style)` Gets a system pointer icon for the given style. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/view/PointerIconCompat` | `https://developer.android.com/reference/androidx/core/view/PointerIconCompat#load(android.content.res.Resources,int)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/res/Resources.html resources, int resourceId)` Loads a custom pointer icon from an XML resource. |

## Constants

### TYPE_ALIAS

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_ALIAS = 1010
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_ALIAS`

### TYPE_ALL_SCROLL

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_ALL_SCROLL = 1013
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_ALL_SCROLL`

### TYPE_ARROW

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_ARROW = 1000
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_ARROW`

### TYPE_CELL

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_CELL = 1006
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_CELL`

### TYPE_CONTEXT_MENU

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_CONTEXT_MENU = 1001
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_CONTEXT_MENU`

### TYPE_COPY

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_COPY = 1011
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_COPY`

### TYPE_CROSSHAIR

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_CROSSHAIR = 1007
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_CROSSHAIR`

### TYPE_DEFAULT

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_DEFAULT = 1000
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_DEFAULT`

### TYPE_GRAB

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_GRAB = 1020
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_GRAB`

### TYPE_GRABBING

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_GRABBING = 1021
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_GRABBING`

### TYPE_HAND

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_HAND = 1002
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_HAND`

### TYPE_HELP

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_HELP = 1003
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_HELP`

### TYPE_HORIZONTAL_DOUBLE_ARROW

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_HORIZONTAL_DOUBLE_ARROW = 1014
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_HORIZONTAL_DOUBLE_ARROW`

### TYPE_NO_DROP

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_NO_DROP = 1012
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_NO_DROP`

### TYPE_NULL

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_NULL = 0
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_NULL`

### TYPE_TEXT

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_TEXT = 1008
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_TEXT`

### TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW`

### TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW`

### TYPE_VERTICAL_DOUBLE_ARROW

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_VERTICAL_DOUBLE_ARROW = 1015
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_VERTICAL_DOUBLE_ARROW`

### TYPE_VERTICAL_TEXT

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_VERTICAL_TEXT = 1009
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_VERTICAL_TEXT`

### TYPE_WAIT

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_WAIT = 1004
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_WAIT`

### TYPE_ZOOM_IN

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_ZOOM_IN = 1018
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_ZOOM_IN`

### TYPE_ZOOM_OUT

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int TYPE_ZOOM_OUT = 1019
```

Synonym for `https://developer.android.com/reference/android/view/PointerIcon.html#TYPE_ZOOM_OUT`

## Public methods

### create

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static @NonNull PointerIconCompat create(@NonNull Bitmap bitmap, float hotSpotX, float hotSpotY)
```

Creates a custom pointer from the given bitmap and hotspot information.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Bitmap.html bitmap` | The bitmap for the icon. |
| `float hotSpotX` | The X offset of the pointer icon hotspot in the bitmap. Must be within the \[0, bitmap.getWidth()) range. |
| `float hotSpotY` | The Y offset of the pointer icon hotspot in the bitmap. Must be within the \[0, bitmap.getHeight()) range. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/view/PointerIconCompat` | A pointer icon for this bitmap. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if bitmap is null, or if the x/y hotspot parameters are invalid. |

### getSystemIcon

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static @NonNull PointerIconCompat getSystemIcon(@NonNull Context context, int style)
```

Gets a system pointer icon for the given style. If style is not recognized, returns the default pointer icon.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | The context. |
| `int style` | The pointer icon style. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/view/PointerIconCompat` | The pointer icon. |

### load

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static @NonNull PointerIconCompat load(@NonNull 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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/res/Resources.html resources` | The resources object. |
| `int resourceId` | The resource id. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/view/PointerIconCompat` | The pointer icon. |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException.html` | if the resource was not found or the drawable linked in the resource was not found. |