开发者

define Bitmap bytes count and set limit to bitmap buffer

In my application I have an image viewer and I am getting bitmaps from web server. In order to increase the performanc开发者_JAVA技巧e of my app, I have a buffer of bitmaps. The max size of one bitmap can be 0.5mb. I have bufferSize variable where I want to store the buffer bytes count and therefore I need to know each Bitmap size which I am going to add in buffer.And if the bites count exceed some X number I delete the bitmap from front of buffer. And here is my problems:

  1. I don't know how to define bitmap bytes count
  2. I need a suggestion about X number .

Thanks in advance.


  1. You can get the number of bytes in a Bitmap using the getByteCount() method.
  2. Depends on how much memory your app is using, how many images you are retrieving from the web server, and how often you need to display them. Use some fraction of System.maxMemory(). In any case
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜