Android Java Binder Failed Binder Transaction?
I am trying to download an image from service and display it in activity but I keep getting java binder FAILED BINDER TRANSACTION This is my service Code public class DownloadIm
Solution 1:
Creating the cache of the image solves my problem
privateLruCache<String, Bitmap> mMemoryCache;
@OverrideprotectedvoidonCreate(Bundle savedInstanceState) {
...
// Get max available VM memory, exceeding this amount will throw an// OutOfMemory exception. Stored in kilobytes as LruCache takes an// int in its constructor.
final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
// Use 1/8th of the available memory for this memory cache.
final int cacheSize = maxMemory / 8;
mMemoryCache = newLruCache<String, Bitmap>(cacheSize) {
@Overrideprotected int sizeOf(String key, Bitmap bitmap) {
// The cache size will be measured in kilobytes rather than// number of items.return bitmap.getByteCount() / 1024;
}
};
...
}
publicvoidaddBitmapToMemoryCache(String key, Bitmap bitmap) {
if (getBitmapFromMemCache(key) == null) {
mMemoryCache.put(key, bitmap);
}
}
publicBitmapgetBitmapFromMemCache(String key) {
return mMemoryCache.get(key);
}
Reference : Caching Bitmaps
Post a Comment for "Android Java Binder Failed Binder Transaction?"