@All,
Thanks for taking the time to read this. I’m looking for a little help hunting down a problem.
Problem System and Version Information:
- Corona SDK 2014.2189 (2013.2100 and 2014.2189 too)
- Nexus 7 Gen 1 Hardware running Android 4.4.2
What I am doing:
- I take a picture with an image,
- save it with ‘display.save()’, and then
- try to use the saved image via ‘display.newImage()’ or ‘display.newImageRect’
What I expect to see:
I expect to see my original snap-shot image (upper half of screen as positioned by my code) and a second copy of the image with a yellow border on the (lower half of screen as positioned by my code).
What I am seeing:
- OS X 10.9 - It works and I see what I expect.
- iOS 7.1.1 on iPad Air - It works and I see what I expect.
- Android 4.4.2 on Nexus 7 Gen 1 - It fails and I see the top image, but the bottom image is just a black rectangle with a yellow border.
- Graphics 1.0 Build 2013.1257 tested on Android 4.4.2 on Nexus 7 Gen 1 - Works w/ legacy ‘display.save()’. :mellow:
What I Suspect Is Wrong (in this order)
- Dumb error in my code or build.settings file. - OR -
- Corona Bug for Android devices. - OR -
- Issue with Android 4.4.2.
What I Need From You
- Folks to take a look at the code below and find a stupid error on my part (totally possible). - AND / OR -
- Folks to run the sample on their own Android devices to verify the issue.
You can get the full sample HERE.
Here are my individual files:
main.lua
local doSave = true local sessionComplete = function(event) local image = event.target print( "Camera ", (image and "returned an image") or "session was cancelled" ) print( "event name: " .. event.name ) print( "target: " .. tostring( image ) ) if ( image ) then local group = display.newGroup() group:insert( image ) image.xScale = 0.1 image.yScale = 0.1 group.x = 160 group.y = 120 if( doSave ) then display.save( group, { filename="thePicture.png", baseDir = system.DocumentsDirectory, isFullResolution = true, backgroundColor = { 0, 0, 0, 1 } } ) timer.performWithDelay( 100, function() local tmp = display.newImageRect( "thePicture.png", system.DocumentsDirectory, 50, 50 ) tmp.x = 160 tmp.y = 360 tmp:setStrokeColor(1,1,0) tmp.strokeWidth = 2 end ) end end end if media.hasSource( media.Camera ) then media.show( media.Camera, sessionComplete ) end
build.settings
settings = { orientation = { default = "portrait", supported = { "portrait" } }, android = { usesPermissions = { "android.permission.CAMERA", "android.permission.WRITE\_EXTERNAL\_STORAGE", }, usesFeatures = { { name = "android.hardware.camera", required = true }, { name = "android.hardware.camera.front", required = false }, }, }, }
Thanks in advance to all takers.