Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>try this for image snap</p> <p>Note: you can not store in resource folder you can only store in SDcard</p> <pre><code> class screen extends MainScreen implements FieldChangeListener { private VideoControl vc; private String encoding; private Player p; private Field viewFinder; private BitmapField bitmapField; private ButtonField btn; public screen() { btn=new ButtonField("snap",Field.FOCUSABLE); btn.setChangeListener(this); add(btn); } public void fieldChanged(Field field, int context) { if(field==btn) { try{ p = Manager.createPlayer("capture://video"); p.realize(); p.prefetch(); p.start(); vc = (VideoControl) p.getControl("VideoControl"); viewFinder = (Field)vc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field"); vc.setVisible(true); final String imageType = "encoding=jpeg&amp;width=640&amp;height=480&amp;quality=superfine"; UiApplication.getUiApplication().invokeLater(new Runnable(){ public void run(){ byte[] image = vc.getSnapshot(imageType); FileConnection conn = (FileConnection)Connector.open("file:///store/home/user/pictures/"+System.currentTimeMillis()+".jpeg", Connector.READ_WRITE); conn.create(); OutputStream out = conn.openOutputStream(); out.write(image); out.flush(); out.close(); conn.close(); Bitmap image1 = Bitmap.createBitmapFromBytes(imageBytes, 0, imageBytes.length, 4); bitmapField.setBitmap(image1); add(bitmapField); } }); } catch (Exception me){ } } } } </code></pre> <p>for more operations please use this <a href="http://supportforums.blackberry.com/rim/attachments/rim/java_dev@tkb/226/1/SnapshotSample.zip" rel="nofollow">http://supportforums.blackberry.com/rim/attachments/rim/java_dev@tkb/226/1/SnapshotSample.zip</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload