我有一个整型数组列表,它在适配器中用来显示图库组件中的图像。
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 };我还有一个从我的应用程序到相机的链接,在那里我们将图像保存为位图。我想在每次保存时更新位图图像到图库组件。你能帮我一下吗?
提前谢谢。
发布于 2011-10-31 13:46:53
从资源制作位图的步骤
Bitmap b = BitmapFactory.decodeResource(getResources(), R.drawable.icon);如果需要,可以像这样制作数组的位图,解码每个元素。
当您拍摄新图像时,您可以使用notifyDataSetChanged将该图像添加到您的array/list并更新适配器。
Bitmap[] images = { BitmapFactory.decodeResource(getResources
(),R.drawable.hm1),BitmapFactory.decodeResource(getResources
(),R.drawable.hm2),BitmapFactory.decodeResource(getResources(),R.drawable.hm3)}; https://stackoverflow.com/questions/7950269
复制相似问题