logo
On this page

Switch a whiteboard


This document describes how to switch the displayed whiteboard.

Prerequisites

Create a whiteboard by referring to Create a super board.

Listen for remote whiteboard switching

ZegoSuperBoardManager.getInstance().setManagerListener(new IZegoSuperBoardManagerListener() {
    // ......

    @Override
    public void onRemoteSuperBoardSubViewSwitched(@NonNull String uniqueID) {
        // Receive remote switching of the whiteboard. No operation is required.
        // The UI can be updated according to data in ZegoSuperBoardManager.getInstance().getSuperBoardView().getCurrentSuperBoardSubView(). For example, the whiteboard name displayed currently can be updated.
    }
});

Proactively switch a whiteboard

ZegoSuperBoardView superBoardView = ZegoSuperBoardManager.getInstance().getSuperBoardView();
// Obtain superBoardView.
if (superBoardView != null) {
    // Switch a whiteboard.
    // subViewModel is a model in the whiteboard sharing list ZegoSuperBoardManager.getInstance().getSuperBoardSubViewModelList().
    superBoardView.switchSuperBoardSubView(subViewModel.uniqueID, new IZegoSuperBoardSwitchCallback() {
        @Override
        public void onViewSwitched(int errorCode) {
            // Receive the callback of whiteboard switching.
            if (errorCode == ZegoSuperBoardError.ZegoSuperBoardSuccess) {
                /** Whiteboard switching succeeded. */
                // The UI can be updated according to data in ZegoSuperBoardManager.getInstance().getSuperBoardView().getCurrentSuperBoardSubView(). For example, the whiteboard name displayed currently can be updated.
            } else {
                /** Whiteboard switching failed. For details about the reason, refer to error codes. */
            }
        }
    });

Previous

Zoom in or out on a whiteboard

Next

Get the whiteboard list

On this page

Back to top