我想知道在 Android 中哪个是存储位图的数组实现的最佳选择。存储位图是个好主意ArrayList<Bitmap>
还是不是一个好的解决方案。
我试图在我的应用程序中存储以编程方式创建的 5 个不同的位图并将它们存储在数组中,它们将它们绘制到 e 画布上,但它无法正常工作。
这是我正在做的事情:
//beginning
ArrayList<Bitmap> temp = new ArrayList<Bitmap>();
//in some function where mBitmap is been created
temp.add(mBitmap);
//in my custom class which extends View
Bitmap bm = Bitmap.createBitmap(temp.get(temp.size()-1));
mCanvas.drawBitmap(bm);
invalidate();
但是来自 temp 的位图从未添加到我的mCanvas
.
任何想法为什么以及在Android / Java中将位图存储在Array中的最佳方式是什么?