I’m using this code to capture and save an image. The image is captured alright, but it does not get saved in the DocumentsDirectory, hence resulting in a warning that the image was not found when i try to display it.
I was going through the forums to check this, and I found some posts around April that said media.show was not supported in simulator back then. I wanted to know if this works on simulator now or not. If yes, what is the error in my code?
local onComplete = function(event)
if event.completed then
-- Camera shot was successfully taken.
local img = display.newImage("CameraShot.jpg", system.DocumentsDirectory, true)
else
-- User canceled out.
end
end
local listener = function( event )
local filePath = { baseDir = system.DocumentsDirectory, filename = "CameraShot.jpg" }
media.show( media.Camera, onComplete, filePath )
return true
end
bkgd:addEventListener( "tap", listener )
[import]uid: 175611 topic_id: 33838 reply_id: 333838[/import]