Reputation: 225
I have a HashMap in which I stored images with Bitmap format. Now the problem is how do I get those images again?
In details, Here in this hasmap, I stored my Bitmap image as an object.
ArrayList<HashMap<String,Object>> mImgList = new ArrayList<HashMap<String,Object>>();
Bitmap img = imgLoader.decodeSampledBitmapFactoryFromUrl(x,x,x,x);
HashMap<String, Object> map = new HashMap<String, Object>();
map.put(TAG_IMG, img);
map.put(TAG_NAME, name);
map.put(TAG_ID, cont_id);
mImgList.add(map);
I use this hashmap in the listview to diplay img and text, everything's fine. But now I need to display some of those images in a ImageView, but I don't know how to get the image as those Bitmap in the HashMap is becoming an object.
I tried to use:
Bitmap bmp = mImgList.get(x).get(TAG_IMG);
but what i got is actualy an object not a bitmap. so how should i get my bitmap? or are there any other way I can display this picture on the alertdialog? thanks!
Upvotes: 1
Views: 1596
Reputation: 225
Turns out no one answered my question...But I end up converting bitmap into drawable so that I can save them into hashmap and get them when i want.
Upvotes: 1