Problem To Display An Image On Android

Hi guys, I have a problem when I try to display an image that is stored in a subfolder within documentsDirectory. To test this in the simulator works correctly but when I try it on a tablet with Android dont works. it is as if the image does not exist.
 
my code is as follows:

[lua]usr = display.newImageRect(usrGroup, “/IMG_CAM/boquerone.bmp”, system.DocumentsDirectory, 80, 80)[/lua]

I’ve tried the following ways but none works:

[lua]usr = display.newImageRect(usrGroup, “/IMG_CAM/” … “boquerone.bmp”, system.DocumentsDirectory, 80, 80)[/lua]

[lua]usr = display.newImageRect(usrGroup, “\IMG_CAM\boquerone.bmp”, system.DocumentsDirectory, 80, 80)[/lua]

[lua]usr = display.newImageRect(usrGroup, “IMG_CAM\boquerone.bmp”, system.DocumentsDirectory, 80, 80)[/lua]

I have read in the forums that a fairly common problem that Android could be the name of the files is case sensitive, but I checked it very well from the beginning and not the problem.

I also tested the png image format and the same thing happens, does not work.

The only way this works is not putting the image in a subfolder within documentsDirectory, so if it works:

[lua]usr = display.newImageRect(usrGroup, “boquerone.bmp”, system.DocumentsDirectory, 80, 80)[/lua]

But this does not help me, I need to access subfolders within documentsDirectory.

I am new to programming in Corona, I hope you can help me.

Greetings and thanks in advance

Hi there,

Try your first approach again, but without the / in front of the folder name.  Like this:

[lua]

usr = display.newImageRect(usrGroup, “IMG_CAM/boquerone.bmp”, system.DocumentsDirectory, 80, 80)

[/lua]

Hope this works!

  • Andrew

Hi, aukStudios, thanks for the suggestion, I’ve tried that and it does not work. 

Still waiting for your answers.

Greetings and thanks in advance

Hi guys, just solved my problem. The file name I had saved in a variable and the value had several spaces at the end, I’ve done a trim and working properly.

Forgive and thanks

Hi there,

Try your first approach again, but without the / in front of the folder name.  Like this:

[lua]

usr = display.newImageRect(usrGroup, “IMG_CAM/boquerone.bmp”, system.DocumentsDirectory, 80, 80)

[/lua]

Hope this works!

  • Andrew

Hi, aukStudios, thanks for the suggestion, I’ve tried that and it does not work. 

Still waiting for your answers.

Greetings and thanks in advance

Hi guys, just solved my problem. The file name I had saved in a variable and the value had several spaces at the end, I’ve done a trim and working properly.

Forgive and thanks