> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/reusable-content/guide/guide-basics-tools-interceptannohandling2.md).

# guide/basics/tools/interceptAnnoHandling2

{% tabs %}
{% tab title="Java" %}

```java
ToolManager.AnnotationModificationListener annotationModificationListener = new ToolManager.AnnotationModificationListener() {
    @Override
    public void onAnnotationsModified(Map<Annot, Integer> annots, Bundle extra) {
        /*
            For example, when a checkbox's value has been changed, this code will print:
            calling method: handleWidget
            property: OTHER
        */
        if (extra != null && extra.containsKey(Tool.METHOD_FROM)) {
            String methodCalling = extra.getString(Tool.METHOD_FROM);
            Log.d("AnnotationsModified", "calling method " + methodCalling);
            AnnotationProperty.Property property = AnnotationProperty.getProperty(methodCalling);
            Log.d("AnnotationsModified", "property: " + property);
        }
        /*
            For example, when annotation opacity is changed to 50%, this code will print:
            calling method: editOpacity
            property: OPACITY
            key: opacity
            value: 0.5
        */
        if (extra != null && extra.containsKey(Tool.KEYS)) {
            String[] paramKeys = extra.getStringArray(Tool.KEYS);
            if (paramKeys != null) {
                for (String key : paramKeys) {
                    Object param = extra.get(key);
                    Log.d("AnnotationsModified", "key: " + key);
                    Log.d("AnnotationsModified", "value: " + param.toString());
                }
            }
        }
    }
};
mToolManager.addAnnotationModificationListener(annotationModificationListener);
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
val annotationModificationListener: ToolManager.AnnotationModificationListener = object : ToolManager.AnnotationModificationListener {
  override fun onAnnotationsModified(annots: MutableMap<Annot, Int>?, extra: Bundle?) {
    /*
      For example, when a checkbox's value has been changed, this code will print:
      calling method: handleWidget
      property: OTHER
      */
    if (extra != null && extra.containsKey(Tool.METHOD_FROM)) {
      val methodCalling = extra.getString(Tool.METHOD_FROM)
      Log.d("AnnotationsModified", "calling method " + methodCalling)
      val property = AnnotationProperty.getProperty(methodCalling)
      Log.d("AnnotationsModified", "property: " + property)
    }
    /*
      For example, when annotation opacity is changed to 50%, this code will print:
      calling method: editOpacity
      property: OPACITY
      key: opacity
      value: 0.5
      */
    if (extra != null && extra.containsKey(Tool.KEYS)) {
      val paramKeys = extra.getStringArray(Tool.KEYS)
      if (paramKeys != null) {
        for (key in paramKeys) {
          val param = extra.get(key)
          Log.d("AnnotationsModified", "key: " + key)
          Log.d("AnnotationsModified", "value: " + param.toString())
        }
      }
    }
  }
}
mToolManager.addAnnotationModificationListener(annotationModificationListener)
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/reusable-content/guide/guide-basics-tools-interceptannohandling2.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
