Skip to content

Instantly share code, notes, and snippets.

@anta40
Forked from amrishodiq/TakingPictureScreen.java
Last active August 29, 2015 14:06
Show Gist options
  • Save anta40/7f253fe46abca09b23cd to your computer and use it in GitHub Desktop.
Save anta40/7f253fe46abca09b23cd to your computer and use it in GitHub Desktop.
/**
* 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