# Use virtual backgrounds

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

> The code on this page only works with the **custom UI**.

Use `isSupportVirtualBG` in `MobileRTCMeetingService` to determine if the device supports virtual backgrounds, then use `MobileRTCMeetingService` to enable them. You can also check if the smart virtual backgrounds - virtual backgrounds with green screens - are supported.

```kotlin
val virtualBackgroundController = ZoomSDK.getInstance().inMeetingService.inMeetingVirtualBackgroundController
if (virtualBackgroundController.isSupportVirtualBG) {
    // Virtual background is supported

    if (virtualBackgroundController.isDeviceSupportSmartVirtualBG) {
        // Smart virtual background is supported
    }
}
```

```java
InMeetingVirtualBackgroundController virtualBackgroundController = ZoomSDK.getInstance().getInMeetingService().getInMeetingVirtualBackgroundController();
if (virtualBackgroundController.isSupportVirtualBG()) {
    // Virtual background is supported

    if (virtualBackgroundController.isDeviceSupportSmartVirtualBG()) {
        // Smart virtual background is supported
    }
}
```

If the device supports virtual backgrounds, use `meetingService` to list, add, remove, and set virtual backgrounds.

```kotlin
/*
 To list available virtual background.
 This list will contained a NONE, BLUR or Item (self added) virtual background type.
 The MobileRTCVirtualBGImageInfo has a isSelect property to indicate if the current virtual background is selected.
 */
val listOfVirtualBG = virtualBackgroundController.bgImageList

// To add virtual background to list, first check if have permission to add
if (virtualBackgroundController.isAllowToAddNewVBItem) {
    val error = virtualBackgroundController.addBGImage(Bitmap!)
}

/*
 To remove a specific virtual background from the list.
 Note: You cannot remove NONE and BLUR type.
 */
virtualBackgroundController.removeBGImage(IVirtualBGImageInfo)

// To set a specific virtual background
virtualBackgroundController.useBGImage(IVirtualBGImageInfo)
```

```java
/*
 To list available virtual background.
 This list will contained a NONE, BLUR or Item (self added) virtual background type.
 The MobileRTCVirtualBGImageInfo has a isSelect property to indicate if the current virtual background is selected.
 */
List<IVirtualBGImageInfo> listOfVirtualBG = virtualBackgroundController.getBGImageList();

// To add virtual background to list, first check if have permission to add
if (virtualBackgroundController.isAllowToAddNewVBItem()) {
    MobileRTCSDKError error = virtualBackgroundController.addBGImage(Bitmap);
}

/*
 To remove a specific virtual background from the list.
 Note: You cannot remove NONE and BLUR type.
 */
virtualBackgroundController.removeBGImage(IVirtualBGImageInfo);

// To set a specific virtual background
virtualBackgroundController.useBGImage(IVirtualBGImageInfo);
```

Users can preview the virtual backgrounds. For more information, refer to [Render user video](/docs/meeting-sdk/android/add-features/render-user-video/) on how to add a preview for the local user.

---
