Camera picture not displaying

Can anyone tell me why line 94 media.show works (when line 92 is commented out) and inputs a picture taken into the display, however the new method of media.capturePhoto line 92 will not (with line 94 commented out)?

Running this on Android

[lua]


– scenetemplate.lua


local storyboard = require( “storyboard” )

local scene = storyboard.newScene()

local widget = require(“widget”)

– Camera not supported on simulator.                    

local isXcodeSimulator = “iPhone Simulator” == system.getInfo(“model”)

if (isXcodeSimulator) then

     local alert = native.showAlert( “Information”, “Camera API not available on iOS Simulator.”, { “OK”})    

end


– 

–    NOTE0:

–    

–    Code outside of listener functions (below) will only be executed once,

–    unless storyboard.removeScene() is called.

– 


local centerX = display.contentCenterX

local centerY = display.contentCenterY

local image


– BEGINNING OF YOUR IMPLEMENTATION


– Called when the scene’s view does not exist:

function scene:createScene( event )

    print(“Selectphoto create scene”)

    local group = self.view

    -----------------------------------------------------------------------------

        

    –    CREATE display objects and add them to ‘group’ here.

    –    Example use-case: Restore ‘group’ from previously saved state.

    

    -----------------------------------------------------------------------------

        image = display.newImage( “images/background.png”, centerX, centerY )

        group:insert( image )

        local nextButton = widget.newButton

                        {

                            left = 100,

                            top = 200,

                            id = “nextButton”,

                            label = “Next”,

                            onEvent = handleButtonEvent,

                            fontSize = 120

                        }

        group:insert( nextButton )

        local onComplete = function(event)    

            print(“Called on complete”)

            local pic = event.target

            print( "Camera ", ( image and “returned an image” ) or “session was cancelled” )

            print( "event name: " … event.name )

            print( "target: " … tostring( image ) )

            if pic then

                pic.x = 300

                pic.y = 300

                pic:scale(0.25, 0.25 )

                pic.x = 100

                pic.y = 300

                print(“Attempting to insert picture”)

                group:insert(pic)

            end

        end

        if media.hasSource( media.Camera ) then

            media.capturePhoto ({ listner = onComplete} )

            print(“Capturing image”)

            --media.show( media.Camera, onComplete )

        else

            native.showAlert(“Buttersoft”, “Camera not found.”)

        end

        

        print(“Create scene end”)

    end

    

    

    – Called immediately after scene has moved onscreen:

    function scene:enterScene( event )

            local group = self.view

        

        -----------------------------------------------------------------------------

            

        –    INSERT code here (e.g. start timers, load audio, start listeners, etc.)

        

        -----------------------------------------------------------------------------

        

    end

    

    

    – Called when scene is about to move offscreen:

    function scene:exitScene( event )

        local group = self.view

        

        -----------------------------------------------------------------------------

        

        –    INSERT code here (e.g. stop timers, remove listeners, unload sounds, etc.)

        

        -----------------------------------------------------------------------------

        

    end

    

    

    – Called prior to the removal of scene’s “view” (display group)

    function scene:destroyScene( event )

        local group = self.view

        

        -----------------------------------------------------------------------------

        

        –    INSERT code here (e.g. remove listeners, widgets, save state, etc.)

        

        -----------------------------------------------------------------------------

        

    end

    

    

    ---------------------------------------------------------------------------------

    – END OF YOUR IMPLEMENTATION

    ---------------------------------------------------------------------------------

    

    – “createScene” event is dispatched if scene’s view does not exist

    scene:addEventListener( “createScene”, scene )

    

    – “enterScene” event is dispatched whenever scene transition has finished

    scene:addEventListener( “enterScene”, scene )

    

    – “exitScene” event is dispatched before next scene’s transition begins

    scene:addEventListener( “exitScene”, scene )

    

    – “destroyScene” event is dispatched before view is unloaded, which can be

    – automatically unloaded in low memory situations, or explicitly via a call to

    – storyboard.purgeScene() or storyboard.removeScene().

    scene:addEventListener( “destroyScene”, scene )


return scene

[/lua]

Android log for media.capturePhoto

01-12 14:04:55.021  13387-13427/? I/Corona: 1: createScene select child

01-12 14:04:58.241  13387-13427/? I/Corona: Selectphoto create scene

01-12 14:04:58.241  13387-13427/? I/Corona: Capturing image

01-12 14:04:58.241  13387-13427/? I/Corona: Create scene end

01-12 14:05:09.441  13387-13387/? D/MediaPlayer: create failed:

        java.io.IOException: setDataSourceFD failed.: status=0x80000000

        at android.media.MediaPlayer.setDataSource(Native Method)

        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:982)

        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:961)

        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:924)

        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:876)

        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:860)

        at android.media.MediaPlayer.create(MediaPlayer.java:794)

        at android.media.MediaPlayer.create(MediaPlayer.java:775)

        at com.ansca.corona.CoronaActivity.getDurationOfVideo(CoronaActivity.java:1188)

        at com.ansca.corona.CoronaActivity.access$200(CoronaActivity.java:22)

        at com.ansca.corona.CoronaActivity$TakeMediaWithExternalActivityResultHandler.onHandleActivityResult(CoronaActivity.java:1823)

        at com.ansca.corona.CoronaActivity.onActivityResult(CoronaActivity.java:1981)

        at android.app.Activity.dispatchActivityResult(Activity.java:5192)

        at android.app.ActivityThread.deliverResults(ActivityThread.java:3146)

        at android.app.ActivityThread.handleSendResult(ActivityThread.java:3193)

        at android.app.ActivityThread.access$1100(ActivityThread.java:130)

        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)

        at android.os.Handler.dispatchMessage(Handler.java:99)

        at android.os.Looper.loop(Looper.java:137)

        at android.app.ActivityThread.main(ActivityThread.java:4754)

        at java.lang.reflect.Method.invokeNative(Native Method)

        at java.lang.reflect.Method.invoke(Method.java:511)

        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)

        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)

        at dalvik.system.NativeStart.main(Native Method)

Android log for media.show

01-12 14:11:52.241  14525-14551/? I/Corona: 1: createScene select child

01-12 14:11:59.951  14525-14551/? I/Corona: Selectphoto create scene

01-12 14:11:59.961  14525-14551/? I/Corona: Capturing image

01-12 14:11:59.971  14525-14551/? I/Corona: Create scene end

01-12 14:12:06.241  14525-14525/? D/MediaPlayer: create failed:

        java.io.IOException: setDataSourceFD failed.: status=0x80000000

        at android.media.MediaPlayer.setDataSource(Native Method)

        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:982)

        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:961)

        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:924)

        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:876)

        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:860)

        at android.media.MediaPlayer.create(MediaPlayer.java:794)

        at android.media.MediaPlayer.create(MediaPlayer.java:775)

        at com.ansca.corona.CoronaActivity.getDurationOfVideo(CoronaActivity.java:1188)

        at com.ansca.corona.CoronaActivity.access$200(CoronaActivity.java:22)

        at com.ansca.corona.CoronaActivity$TakeMediaWithExternalActivityResultHandler.onHandleActivityResult(CoronaActivity.java:1823)

        at com.ansca.corona.CoronaActivity.onActivityResult(CoronaActivity.java:1981)

        at android.app.Activity.dispatchActivityResult(Activity.java:5192)

        at android.app.ActivityThread.deliverResults(ActivityThread.java:3146)

        at android.app.ActivityThread.handleSendResult(ActivityThread.java:3193)

        at android.app.ActivityThread.access$1100(ActivityThread.java:130)

        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)

        at android.os.Handler.dispatchMessage(Handler.java:99)

        at android.os.Looper.loop(Looper.java:137)

        at android.app.ActivityThread.main(ActivityThread.java:4754)

        at java.lang.reflect.Method.invokeNative(Native Method)

        at java.lang.reflect.Method.invoke(Method.java:511)

        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)

        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)

        at dalvik.system.NativeStart.main(Native Method)

01-12 14:12:06.331  14525-14551/? I/Corona: Called on complete

01-12 14:12:06.331  14525-14551/? I/Corona: Camera     returned an image

01-12 14:12:06.331  14525-14551/? I/Corona: event name: completion

01-12 14:12:06.331  14525-14551/? I/Corona: target: table: 0x5be01770

01-12 14:12:06.331  14525-14551/? I/Corona: Attempting to insert picture

Perhaps its that you have listener misspelled here:
 

media.capturePhoto ({ listner = onComplete} )

try it as:

media.capturePhoto ({ listener = onComplete} )

Rob

Perhaps its that you have listener misspelled here:
 

media.capturePhoto ({ listner = onComplete} )

try it as:

media.capturePhoto ({ listener = onComplete} )

Rob