private void DoCaptureImage() {
        try {
            String type = System.getProperty("video.snapshot.encodings");
            byte[] imageData = videoControl.getSnapshot("encoding=jpeg");
            capturedImageBytes = imageData;
            capturedImage = Image.createImage(imageData, 0, imageData.length);
            PCommand cmdCapture = new PCommand("Retake photo", Command.OK, PCommand.CAPTURE_PICTURE, 0);
            Form imageFrm = new Form("Captured Image");
            imageFrm.append(capturedImage);
            //  imageFrm.addCommand(exit);
            imageFrm.addCommand(back);
            imageFrm.addCommand(cmdCapture);

            // lastDisplay = display.getCurrent();
            imageFrm.setCommandListener(this);
            display.setCurrent(imageFrm);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }