package tan.myplay
import java.util.ArrayList;
import java.util.HashMap;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
public class BitmapUtils {
int[] mPhotos = {
R.drawable.p1,
R.drawable.p2,
R.drawable.p3,
R.drawable.p4,
R.drawable.two_of_cairo_museum_looted_artefacts_found_in_garden,
};
int numb = mPhotos.length;
String[] mDescriptions = {
" 18th dynasty monarch, better known as King Tut, ruled in the 13th century BC. ",
"2. I took this shot with a pinhole camera ",
"3. I don't remember where or when I took t",
"4. Right the detritus of mankind.",
};
static HashMap<Integer, Bitmap> sBitmapResourceMap = new HashMap<Integer, Bitmap>();
public ArrayList<PictureData> loadPhotos(Resources resources) {
ArrayList<PictureData> pictures = new ArrayList<PictureData>();
for (int i = 0; i < numb; ++i) {
int resourceId = mPhotos[(int) (Math.random() * mPhotos.length)];
Bitmap bitmap = getBitmap(resources, resourceId);
Bitmap thumbnail = getThumbnail(bitmap, 200);
String description = mDescriptions[(int) (Math.random() * mDescriptions.length)];
pictures.add(new PictureData(resourceId, description, thumbnail));
}
return pictures;
}_
`