diff --git a/media/Camera/entry/src/main/java/ohos/samples/camera/TakePhotoAbility.java b/media/Camera/entry/src/main/java/ohos/samples/camera/TakePhotoAbility.java index d8401fe20..1242b7d83 100644 --- a/media/Camera/entry/src/main/java/ohos/samples/camera/TakePhotoAbility.java +++ b/media/Camera/entry/src/main/java/ohos/samples/camera/TakePhotoAbility.java @@ -134,7 +134,7 @@ public class TakePhotoAbility extends Ability { break; } } - if (cameraId != null && !cameraId.equals("")) { + if (cameraId != null && !cameraId.isEmpty()) { CameraStateCallbackImpl cameraStateCallback = new CameraStateCallbackImpl(); cameraKit.createCamera(cameraId, cameraStateCallback, eventHandler); } diff --git a/media/Camera/entry/src/main/java/ohos/samples/camera/VideoRecordAbility.java b/media/Camera/entry/src/main/java/ohos/samples/camera/VideoRecordAbility.java index 455775911..ba7de740b 100644 --- a/media/Camera/entry/src/main/java/ohos/samples/camera/VideoRecordAbility.java +++ b/media/Camera/entry/src/main/java/ohos/samples/camera/VideoRecordAbility.java @@ -177,7 +177,7 @@ public class VideoRecordAbility extends Ability { break; } } - if (cameraId != null && !cameraId.equals("")) { + if (cameraId != null && !cameraId.isEmpty()) { CameraStateCallbackImpl cameraStateCallback = new CameraStateCallbackImpl(); cameraKit.createCamera(cameraId, cameraStateCallback, eventHandler); }