blackberryjava-mecamerablackberry-simulator

Capture pictues in blackberry application using VideoControl only works on emulator and not device


This is only some of the code because other parts of it are spread out but on the simulator for blackberry curve this adds a VideoControl to the manager and shows up fine with another button that actually captures the picture. However, when I run this on an actual Blackberry curve (version 6 I think) it doesn't display this on the screen.

try 
     {
         _p = javax.microedition.media.Manager.createPlayer("capture://video?encoding=jpeg&width=1024&height=768");
         _p.realize();
         _videoControl = (VideoControl) _p.getControl("VideoControl");

         if (_videoControl != null)
         {
             videoField = (Field) _videoControl.initDisplayMode (VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
          //   _videoControl.setDisplayFullScreen(true);
             _videoControl.setVisible(true);
            // EnhancedFocusControl efc = (EnhancedFocusControl)p.getControl("net.rim.device.api.amms.control.camera.EnhancedFocusControl");
            // efc.startAutoFocus();
             _p.start();


             if(videoField != null)
             {
                 add(videoField);
             }
         } 
     }
     catch(Exception e)
     {
         Dialog.alert(e.toString());
     }

Solution

  • In my experience the way of image taking you use has appeared very unreliable (it worked fine only on a limited number of devices), so I stopped using it. Use native Camera app instead - it works fine on all devices.