Created
September 23, 2011 06:50
-
-
Save amrishodiq/1236867 to your computer and use it in GitHub Desktop.
Blackberry - Use this snippet as an example of how to capture image using native camera in Blackberry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* To use this example, you need to grap my repository on | |
* https://github.com/amrishodiq/Blackberry-Development-Tutorial/tree/master/TakingPicture/src/com/durianberry/takingpicture | |
*/ | |
public final class TakingPictureScreen extends MainScreen implements | |
PictureTakerListener, FieldChangeListener { | |
private ButtonField button; | |
private BitmapField photoField; | |
public TakingPictureScreen() { | |
setTitle("Taking Picture"); | |
button = new ButtonField("Take Picture", ButtonField.CONSUME_CLICK); | |
button.setChangeListener(this); | |
add(button); | |
photoField = new BitmapField(); | |
add(photoField); | |
} | |
public void fieldChanged(Field field, int context) { | |
if (field == button) { | |
PictureTaker.get().setListener(this); | |
PictureTaker.get().takePicture(); | |
} | |
} | |
public void onPictureCaptured(EncodedImage image) { | |
photoField.setImage(ImageTools.scaleImageToWidth(image, Display.getWidth())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment