# Manage in-meeting annotation

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

> The code on this page works with either the **default UI** or the **custom UI**.

When users start sharing their screens, others can annotate on top of the shared video feed. Through the SDK, you can manage many settings related to the appearance and availability of annotation.

## Annotation settings

Before starting to annotate, [check the meeting settings in the web portal](https://support.zoom.com/hc/en/article?id=zm_kb&sysparm_article=KB0060943) to confirm that it is currently enabled. Check synchronously through the annotation controller, or receive updates asynchronously through the `InMeetingAnnotationListener`.

```kotlin
val annotationListener = InMeetingAnnotationListener { shareUserId, support ->
    if (support) {
        // Annotation is now supported for the current share content.
    }

    currentShareId = shareUserId // Optionally, store the ID of the user who is currently sharing.
}

val annotationController = ZoomSDK.getInstance().inMeetingService.inMeetingAnnotationController
annotationController.addListener(annotationListener)

if (!annotationController.isViewerAnnotationDisabled && annotationController.canDoAnnotation()) {
    // Annotations can be performed
}
```

```java
InMeetingAnnotationController annotationController = ZoomSDK.getInstance().getInMeetingService().getInMeetingAnnotationController();
InMeetingAnnotationController.InMeetingAnnotationListener annotationListener = new InMeetingAnnotationController.InMeetingAnnotationListener() {
    @Override
    public void onAnnotationSupportChanaged(int shareUserId, boolean support) {
        if (support) {
            // Annotations are enabled
        }
        currentShareId = shareUserId;
    }
};
annotationController.addListener(annotationListener);

if (!annotationController.isViewerAnnotationDisabled() && annotationController.canDoAnnotation()) {
    // Annotations can be performed
}
```

If the current user is sharing their screen, they can enable or disable viewers to annotate the shared screen.

```kotlin
if (annotationController.canDisableViewerAnnotation()) {
    annotationController.disableViewerAnnotation(true)
}
```

```java
if (annotationController.canDisableViewerAnnotation()) {
    annotationController.disableViewerAnnotation(true);
}
```

## Control annotation properties

In some scenarios, the SDK by default shows an annotation toolbar overlay when it is possible for users to annotate. Replace this with your own UI using the concepts described here. Before doing so, you can optionally hide the default overlay.

```kotlin
ZoomSDK.getInstance().meetingSettingsHelper.hideAnnotationInScreenShareToolbar(true)
```

```java
ZoomSDK.getInstance().getMeetingSettingsHelper().hideAnnotationInScreenShareToolbar(true);
```

In custom UI mode, the annotation toolbar is only displayed when the current user is sharing their screen. To annotate when another user in the meeting shares their screen, use the `InMeetingAnnotationController` to manage annotations.

To start annotating, call `startAnnotation`. When annotation is finished, use `stopAnnotation`.

```kotlin
val startResult = annotationController.startAnnotation()
if (startResult == MobileRTCSDKError.SDKERR_SUCCESS) {
    // You can begin using the annotation tool
}

annotationController.stopAnnotation()
```

```java
MobileRTCSDKError startResult = annotationController.startAnnotation();
if (startResult == MobileRTCSDKError.SDKERR_SUCCESS) {
    // You can begin using the annotation tool
}
```

Optionally, after verifying that annotation started based on the return value of `startAnnotation`, modify the annotation appearance programmatically.

```kotlin
annotationController.setToolColor(Color.BLUE)
annotationController.setToolType(InMeetingAnnotationController.AnnotationToolType.ANNO_TOOL_TYPE_PEN)
annotationController.setToolWidth(10)
```

```java
annotationController.setToolColor(Color.BLUE);
annotationController.setToolType(InMeetingAnnotationController.AnnotationToolType.ANNO_TOOL_TYPE_PEN);
annotationController.setToolWidth(10);
```

Interact with annotations users create by undoing or redoing annotations.

```kotlin
annotationController.undo()
annotationController.redo()
```

```java
annotationController.undo()
annotationController.redo()
```

Based on your use case, you may also need to know if the current user is the presenter before updating your annotation UI.

```kotlin
if (annotationController.isPresenter) {
    ...
}
```

```java
if (annotationController.isPresenter()) {
    …
}
```

When the meeting no longer needs annotation, remove the listener.

```kotlin
annotationController.removeListener(annotationListener)
```

```java
annotationController.removeListener(annotationListener);
```

---
