Loading image from cache using BitmapFactory.decodeStream() in Android

后端 未结 1 449
渐次进展
渐次进展 2021-01-24 21:57

UPDATES: Even if i don\'t retrieve images from cache, i tried to retrieve via Drawable where i stored all the 18 images in the \"drawable-mdpi\" folder. Still,

相关标签:
1条回答
  • 2021-01-24 22:22

    I just solved my own question.

    In this line, canvas.drawBitmap(puzzle.get(cnt), srcRect, dstRect,null); within each of the for-loop which i am using it to draw the bitmap onto the canvas, i need to cast the each item in the ArrayList (puzzle) to Bitmap. Only then will the image get display.

    I thought that if the ArrayList is definite as such, ArrayList<Bitmap> puzzle = new ArrayList<Bitmap>(); each items in the ArrayList would be of Bitmap type. But isn't that always true?

    0 讨论(0)
提交回复
热议问题