my following code returns null ,
byte[开发者_StackOverflow] image1 = _videoControl.getSnapshot(null);
any suggestion please
Few important moments about VideoControl.getSnapshot method:
- some manufacturers may not implement getSnapshot() method;
- the viewfinder must actually be visible on the screen prior to calling getSnapShot();
- if you attempt to take pictures too quickly, however, getSnapShot() may return null. The camera requires time to clear out its buffer and prepare for the next shot;
- you may check MMAPI System Property for "video.snapshot.encodings" before capturing:
if (System.getProperty("video.snapshot.encodings") == null) { // getSnapshot() is not supported }
You may read this chapter from book "Advanced BlackBerry Development": http://books.google.com/books?id=F4Qu-lpoVncC&pg=PA53&lpg=PA53#v=onepage&q&f=false
Since VideoControl.getSnapshot
method is not supported by all devices I'd recommend to use another approach. You can start the native BB Camera app with this line of code:
Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, new CameraArguments());
and then using the FileSystemJournalListener
catch the taken image.
The BB SDK on your PC contains samples. Search for 'fileexplorerdemo' sample to see the rest of details.
精彩评论