Display images stored at system.DocumentsDirectory

Hi everyone,

i am doing a university project that i need to finish this week, so time is little.

I am trying to display images stored at system.DocumentsDirectory, if i copied images from system.ResourceDirectory to system.DocumentsDirectory i can display them on the screen, but if i downloaded the images directly from a remote server to the system.DocumentsDirectory, i can’t display them on the screen.

Note: On corona simulator everything works nice, but per example on droid4x simulator, using the APK file, the problem appears.

Why this happens?

Greetings

How are you downloading the images?

Rob

Using this,

network.download( “http://localhost:8888/”…decodedData[i]…"", “GET”, networkListener, params, decodedData[i], base )

What is base?

Can you put some prints in your networkListener function and see what is in the event table that’s passed in? 

This is the code i am using to download and store the images.

local decodedData local params = {} local temp\_path = system.pathForFile( "", system.DocumentsDirectory ) local success = lfs.chdir( temp\_path ) local base = system.DocumentsDirectory params.progress = true local function networkListener( event ) if ( event.isError ) then print( "Network error - download failed" ) elseif ( event.phase == "began" ) then print( "Progress Phase: began" ) elseif ( event.phase == "ended" ) then print( "file downloaded" ) end end local fileName = "" local folderImages = "images/" local folderDocs = "docs/" local function SaveData() for i = 1, #decodedData do fileName = decodedData[i]:sub( 8 ) network.download( "http://localhost:8888/"..decodedData[i].."", "GET", networkListener, params, decodedData[i], base ) end end

How are you downloading the images?

Rob

Using this,

network.download( “http://localhost:8888/”…decodedData[i]…"", “GET”, networkListener, params, decodedData[i], base )

What is base?

Can you put some prints in your networkListener function and see what is in the event table that’s passed in? 

This is the code i am using to download and store the images.

local decodedData local params = {} local temp\_path = system.pathForFile( "", system.DocumentsDirectory ) local success = lfs.chdir( temp\_path ) local base = system.DocumentsDirectory params.progress = true local function networkListener( event ) if ( event.isError ) then print( "Network error - download failed" ) elseif ( event.phase == "began" ) then print( "Progress Phase: began" ) elseif ( event.phase == "ended" ) then print( "file downloaded" ) end end local fileName = "" local folderImages = "images/" local folderDocs = "docs/" local function SaveData() for i = 1, #decodedData do fileName = decodedData[i]:sub( 8 ) network.download( "http://localhost:8888/"..decodedData[i].."", "GET", networkListener, params, decodedData[i], base ) end end