Downloaded image not displaying on Android

I’m attempting to perform a simple image download in an application for the Android. The app works fine in the simulator, but when installed on the device the downloaded image does not display. Here is my code:

local http = require('socket.http');  
local ltn12 = require('ltn12');  
function loadImage( event )  
  
 if ( event.type == 'applicationStart' ) then  
  
 -- create local version of image to be downloaded  
 local path = system.pathForFile ( 'new\_logo.jpg', system.TemporaryDirectory );  
 local myFile = io.open ( path, 'w+b' );  
  
 -- download image  
 local r,e = http.request{   
 url='http://i.ehowcdn.com/ui/images/logos/new\_logo.jpg',  
 sink=ltn12.sink.file(myFile)  
 }   
  
  
 if ( r ) then  
  
 -- display text with status of downloaded image  
 local txt = display.newText ('Image Loaded ' .. tostring(e), display.contentWidth/2 - 90, display.contentHeight/2 - 30, native.systemFontBold, 20);  
 txt:setTextColor ( 255, 255, 255, 255 );  
  
 -- display image  
 local img = display.newImage ( 'new\_logo.jpg', system.TemporaryDirectory, 164, display.contentHeight/2 + 50, true );  
  
 else  
 -- display error message  
 local errortxt = display.newText ('ERROR: ' .. tostring(e), display.contentWidth/2, display.contentHeight/2, native.systemFontBold, 20);  
 errortxt.x = display.contentWidth/2;  
 errortxt.y = display.contentHeight/2 - 30;  
 errortxt:setTextColor ( 255, 0, 0, 255 );  
 end  
  
 end  
  
end  
Runtime:addEventListener ( 'system', loadImage );  
  
-- HERE IS THE CODE FOR THE BUILD.SETTINGS FILE:  
  
settings =   
{   
 androidPermissions =   
 {  
 "android.permission.INTERNET"  
 },  
}  

The textfield tells me that the image was successfully downloaded as it returns the HTTP status code of 200. Also, when I go to SETTINGS>MANAGE APPLICATION and check the app it shows the app contains 12Kb of data - which is the size of the image.

[import]uid: 6297 topic_id: 1504 reply_id: 301504[/import]

Another note that might be of use in troubleshooting: I traced the width/height of the image and in the simulator it displays at 151x54 pixels; on the device it displays at 0x0 pixels.

This is some very basic functionality here and it is extremely frustrating not to be able to perform the simplest actions with this SDK. I would appreciate some help soon or I’m going to have to jump ship and go with something that actually works the way it’s supposed to. [import]uid: 6297 topic_id: 1504 reply_id: 4251[/import]

Just saw this in the release notes:
Networking support for Android. Known issues on Android: problems with saving images to a file off the network, e.g. “SimpleImageDownload” example

Which kind of kills a huge part of the network capability. Any chance this will be addressed in the next beta release? [import]uid: 6297 topic_id: 1504 reply_id: 4252[/import]

filed case #381 “pathForFile not working on Android device” on 7/24

carlos [import]uid: 24 topic_id: 1504 reply_id: 4259[/import]

It’s priority 2, which means it’s likely to get looked at right away. [import]uid: 54 topic_id: 1504 reply_id: 4263[/import]

It wasn’t the same issue, so we opened case #429. And fixed it in beta 7. [import]uid: 54 topic_id: 1504 reply_id: 4304[/import]

Hi,

I Downloaded the Beta 7 and it still don’t work for me -_-. [import]uid: 7826 topic_id: 1504 reply_id: 4903[/import]