Reputation: 29
I have an int array list which is used in an adapter to display images in gallery component.
int[] images = { R.drawable.hm1, R.drawable.hm2, R.drawable.hm3,
R.drawable.hm4, R.drawable.hm5, R.drawable.hm6, R.drawable.hm7,
R.drawable.hm8, R.drawable.hm9, R.drawable.hm10, R.drawable.hm11,
R.drawable.hm12, R.drawable.hm13, R.drawable.hm14, R.drawable.hm15,
R.drawable.hm16, R.drawable.hm17, R.drawable.hm18, R.drawable.hm19,
R.drawable.hm20 };
Also i have a link to camera from my application, where we r saving the image to bitmap..i want to update the bitmap image to gallery component everytime i save it. Can u help me for this..?
Thanks in advance.
Upvotes: 0
Views: 3619
Reputation: 34301
To Make Bitmap from the Resource
Bitmap b = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
If you need can make array of the bitmap like this decoding each element.
When you take new image you can add that image to your array/list
and update the adapter using notifyDataSetChanged
.
Bitmap[] images = { BitmapFactory.decodeResource(getResources
(),R.drawable.hm1),BitmapFactory.decodeResource(getResources
(),R.drawable.hm2),BitmapFactory.decodeResource(getResources(),R.drawable.hm3)};
Upvotes: 1