In my project I was loading images dinamically from the folder drawable-hdpi into an ImageSwitcher
like this:
int[] images = new int[2];
logoImage = (ImageSwitcher) findViewById(R.id.logo_image);
images[0] = getResources().getIdentifier(ej.getImagemResource(), "drawable", getPackageName());
images[1] = getResources().getIdentifier(ej.getImagemResolvidaResource(), "drawable", getPackageName());
//...
logoImage.setImageResource(images[0]);
but for design issues, since it will be like 600 hundred little images 300 x 300 pixels each I decided to put them all into the assets folder and start to load them like:
Drawable[] images = new Drawable[2];
images[0] = Drawable.createFromStream(getAssets().open(ej.getImagemResource() + ".png"), null);
images[1] = Drawable.createFromStream(getAssets().open(ej.getImagemResolvidaResource() + ".png"), null);
//...
The problem is that in the second way the image size is displayed very differently depending on the device density (I guess), but when the images were into the drawable-hdpi folder they were displayed just fine in any density.
How do I solve this? Or is there a problem to have 600 hundred images into the drawable-hdpi folder? Which is the 'right' way to do this?
Thanks in advance