---
title: "Annotation editing on Android | Nutrient"
canonical_url: "https://www.nutrient.io/guides/android/user-interface/contextual-toolbars/annotation-editing/"
md_url: "https://www.nutrient.io/guides/android/user-interface/contextual-toolbars/annotation-editing.md"
last_updated: "2026-05-23T00:08:18.003Z"
description: "When annotations are selected, Nutrient Android SDK shows a popup toolbar next to the annotation with editing actions."
---

# Annotation editing on Android

When an annotation is selected, Nutrient Android SDK shows a popup toolbar directly next to the annotation on the page. The popup toolbar provides contextual actions for the selected annotation.

To learn more about customizing the style of toolbars, refer to our information on [toolbar styling](https://www.nutrient.io/guides/android/customizing-the-interface/appearance-styling.md#toolbar-styling).

## Selecting annotations programmatically

When a user taps an annotation, the activity will enter annotation mode for the selected annotation.

In your code, you can select annotations programmatically by calling [`PdfFragment#setSelectedAnnotation`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/set-selected-annotation.html):

### KOTLIN

```kotlin

pdfFragment.setSelectedAnnotation(annotation)

```

### JAVA

```java

getPdfFragment().setSelectedAnnotation(annotation);

```

To leave the annotation mode (switching back to the normal viewing mode), you can call [`PdfFragment#exitCurrentlyActiveMode`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/exit-currently-active-mode.html):

### KOTLIN

```kotlin

// Leaves a previously launched annotation mode.
pdfFragment.exitCurrentlyActiveMode()

```

### JAVA

```java

// Leaves a previously launched annotation mode.
getPdfFragment().exitCurrentlyActiveMode();

```

[`PdfFragment#exitCurrentlyActiveMode`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/exit-currently-active-mode.html) can also be used to leave other special modes — for example, annotation creation or text selection.

## Mode listeners

If you need more control over annotation mode, you can register an [`OnAnnotatingModeChangeListener`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui.annotations/-on-annotating-mode-change-listener/index.html) on the fragment. After entering annotation mode, the listener will be called, giving you access to the [`AnnotatingController`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui.special_mode.controller/-annotating-controller/index.html). The controller object gives you access to all annotation mode actions — saving, deleting, toggling the inspector, selecting annotations, etc.

## Popup toolbar actions

The popup toolbar offers several actions for performing operations on a selected annotation:

| Action        | Description                                              |
| ------------- | -------------------------------------------------------- |
| Copy          | Copies the selected annotation to the clipboard.         |
| Delete        | Deletes the selected annotation.                         |
| Inspector     | Opens the [annotation inspector](https://www.nutrient.io/guides/android/annotations/annotation-inspector.md) (color/style picker). |
| Note          | Opens the annotation note editor.                        |
| Share         | Shares the annotation contents.                          |
| Play/Record   | Plays or records sound annotations.                      |
| Group/Ungroup | Groups or ungroups selected annotations.                 |

## Customizing the popup toolbar

You can customize the annotation popup toolbar before it’s displayed by registering an [`OnPreparePopupToolbarListener`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.listeners/-on-prepare-popup-toolbar-listener/index.html) on the fragment. Override `onPrepareAnnotationPopupToolbar` to modify the toolbar items:

### KOTLIN

```kotlin

pdfFragment.setOnPreparePopupToolbarListener(object : OnPreparePopupToolbarListener {
    override fun onPrepareAnnotationPopupToolbar(toolbar: AnnotationPopupToolbar) {
        // Access the currently selected annotations.
        val annotations = toolbar.annotations

        // Remove or add menu items as needed.
        val menuItems = toolbar.menuItems.toMutableList()
        menuItems.removeAll { it.id == R.id.pspdf__annotation_popup_toolbar_item_share }
        toolbar.menuItems = menuItems
    }
})

```

### JAVA

```java

getPdfFragment().setOnPreparePopupToolbarListener(new OnPreparePopupToolbarListener() {
    @Override
    public void onPrepareAnnotationPopupToolbar(@NonNull AnnotationPopupToolbar toolbar) {
        // Access the currently selected annotations.
        List<Annotation> annotations = toolbar.getAnnotations();

        // Remove or add menu items as needed.
        List<PopupToolbarMenuItem> menuItems = new ArrayList<>(toolbar.getMenuItems());
        menuItems.removeIf(item -> item.getId() == R.id.pspdf__annotation_popup_toolbar_item_share);
        toolbar.setMenuItems(menuItems);
    }
});

```

The [`OnPreparePopupToolbarListener`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.listeners/-on-prepare-popup-toolbar-listener/index.html) also provides callbacks for other popup toolbar types. See the [popup toolbar customization](https://www.nutrient.io/guides/android/releases/11-3.md#popup-toolbar-customization) section in the 11.3 release notes for the full list.

## Annotation inspector

The annotation inspector is a Nutrient UI component that allows editing of annotation properties. Once you open it, it’ll slide up from the bottom of the screen. To learn more about the annotation inspector, refer to the [annotation inspector](https://www.nutrient.io/guides/android/annotations/annotation-inspector.md) guide.
---

## Related pages

- [Customizing the annotation creation toolbar in our Android PDF viewer](/guides/android/annotations/custom-annotation-editing-controls.md)
- [Customizing toolbars in our Android PDF viewer](/guides/android/customizing-the-interface/customizing-the-toolbar.md)
- [Effortlessly customize text selection in Android](/guides/android/user-interface/contextual-toolbars/text-selection.md)
- [Customizing the PDF editing toolbar on Android](/guides/android/features/document-editor.md)
- [Using contextual toolbars within PdfFragment](/guides/android/customizing-the-interface/using-toolbars-within-fragment.md)

