我在使用新的Volley库实现图像缓存时遇到了问题。在演示中,代码看起来是这样的:
mRequestQueue = Volley.newRequestQueue(context);
mImageLoader = new ImageLoader(mRequestQueue, new BitmapLruCache());
BitmapLruCache显然不包含在工具包中。是否有任何实现它或指向一些资源的想法?
http://www.youtube.com/watch?v=yhv8l9F44qo @14:38
谢谢!
N * screen_width * screen_height
这样的公式,其中N ~ 10
对我来说似乎很合理。 - Vladimir Mironovint
溢出,建议使用@njzk2。Runtime.maxMemory()
返回的是long
类型,强制转换为int
可能会导致溢出。这里的除法只是为了尽量减小可能性。 - Vladimir Mironov