Image Capture with Say Cheese

Say Cheese has an intent filter for capturing images for other applications. Say Cheese only returns the actual snapshot, not a reduced size file or bitmap data. So the application is required to pass to Say Cheese the URI of the file location where it wants Say Cheese to store the snap shot.

Here is some sample code:

Java Example

// Request a camera snapshot and store the file in the location specified in _path

protected void startCameraActivity()
    File file = new File( _path );
    Uri outputFileUri = Uri.fromFile( file );

    Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE );
    intent.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri );

    startActivityForResult( intent, 0 );
protected void onActivityResult(int requestCode, int resultCode, Intent data)
    Log.i( "MakeMachine", "resultCode: " + resultCode );
    switch( resultCode )
    	case 0:
    		Log.i( "Say Cheese Snapshot", "User cancelled" );

    	case -1:
FlashBuilder 4.5 Example

<s:Application xmlns:fx="" 
private var camera:CameraUI;
protected function application1_applicationCompleteHandler(event:FlexEvent):void {
if (CameraUI.isSupported){
camera = new CameraUI();
camera.addEventListener(MediaEvent.COMPLETE, onComplete);
camera.addEventListener(ErrorEvent.ERROR, onError);
status.text="CameraUI supported";
} else {
status.text="CameraUI NOT supported";
private function captureImage(event:MouseEvent):void {
private function onError(event:ErrorEvent):void {
trace("error has occurred");
private function onComplete(event:MediaEvent):void {
var mediaPromise:MediaPromise =;
status.text = mediaPromise.file.url;
image.source = mediaPromise.file.url;
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:Label id="status" text="Click Take a Picture button" top="10" width="100%" textAlign="center"/>
<s:Button width="300" height="60" label="TAKE A PICTURE" click="captureImage(event)"
  horizontalCenter="0" enabled="{CameraUI.isSupported}"
<s:Image id="image" width="230" height="350" horizontalCenter="0" top="170"/>