how to read multiple images?

All your problems with Audio, Video and Images.

how to read multiple images?

Postby notwizard » Tue Jan 20, 2009 10:01 pm

Hi,
For example, I have several images under drawable folder: img1, img2, img3, ...img50. Is there a way to read these images with a loop, instead of loading it 50 times manually?
Second question, is there a way to create sub folders under drawable so that I can manage different kind of images in my application.
Third question, I try to push a text file into the emulator. However, I cannot find the files folder under /data/data/myapp. Is there a way to create the files folder myself? I really cannot find where this feature is located.
Thanks for your help~
notwizard
Freshman
Freshman
 
Posts: 2
Joined: Tue Jan 20, 2009 8:50 pm

Top

Re: how to read multiple images?

Postby MrSnowflake » Tue Jan 20, 2009 11:13 pm

notwizard wrote:Hi,
For example, I have several images under drawable folder: img1, img2, img3, ...img50. Is there a way to read these images with a loop, instead of loading it 50 times manually?
You can use reflection for this. Get all the fields of R.drawable and loop throug them. Though it could be this won't work, as I've read somewhere that reflection is kinda strange on Android.
notwizard wrote:Second question, is there a way to create sub folders under drawable so that I can manage different kind of images in my application.
AFAIK this is not possible.
notwizard wrote:Third question, I try to push a text file into the emulator. However, I cannot find the files folder under /data/data/myapp. Is there a way to create the files folder myself? I really cannot find where this feature is located.
How do you push it? Maybe you've put it on the SD, or in some other folder than /data/data/myapp...
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby notwizard » Tue Jan 20, 2009 11:21 pm

Thanks, MrSnowFlake.
For the third question, I did the push file via the DDMS perspective of Eclipse IDE. From there I can only see data/data/myapp/lib folder. There is no data/data/myapp/files folder. Now I am putting my text file into data/data/myapp/myfile.txt. And it works now. But I am thinking if this is the right place to put my text file into.
notwizard
Freshman
Freshman
 
Posts: 2
Joined: Tue Jan 20, 2009 8:50 pm

Postby MrSnowflake » Wed Jan 21, 2009 1:03 am

I've never used the ddms perspective to push files to the emu, only command-line, so can't help you with that.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 17 guests