Assigning image resources using a loop

All your problems with Audio, Video and Images.

Assigning image resources using a loop

Postby cnatale37 » Thu Jun 11, 2009 2:05 pm

Say I've got a string of image resources with names like img0001, img0002, img0003, etc. I want to be able to add them to a game I'm working on in an ArrayList of BitmapData objects, using a nice and clean for loop. Something like this:

Code: Select all
ArrayList imageList = new ArrayList();
for(short i=0; i<20; i++){
  imageList.add(R.drawable.imgxxxx);
}


Is this possible in java, or can someone help me do something that produces a similar effect?

Thanks!
cnatale37
Freshman
Freshman
 
Posts: 2
Joined: Fri May 22, 2009 6:00 pm

Top

Postby nithin11 » Wed Jun 17, 2009 1:19 pm

Hi...

Its possible.... but i updating 8 images at time... Same concept.... How i did was First access images from the resources... and put it into list.... Then i access from list using loop

Thank You
Nithin
nithin11
Developer
Developer
 
Posts: 36
Joined: Mon Mar 09, 2009 5:14 am
Location: India

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 12 guests