Questions tagged [android-lru-cache]

LruCache holds strong references to a limited number of values. Each time a value is accessed, it is moved to the head of a queue. When a value is added to a full cache, the value at the end of that queue is evicted and may become eligible for garbage collection.

LruCache holds strong references to a limited number of values. Each time a value is accessed, it is moved to the head of a queue. When a value is added to a full cache, the value at the end of that queue is evicted and may become eligible for garbage collection.

109 questions
0
votes
1 answer

Implementing LruCache

I am trying to implement Lru Cache into my program to have my listview scroll faster. I am not sure what to place in the Bitmap value of addBitmapToCache(String key, Bitmap bitmap (indicated by XXXXXX). Anyone have a suggestion? Thank you. public…
Michael
  • 83
  • 9
0
votes
0 answers

Using DiskLruImageCache in a class

I am trying follow this answer to cache the bitmaps that I need to display in a listview. But there is no mentioning anywhere on how to use it in a class. Can anyone give me a sample code on how to use the DiskLruImageCache in a class? EDIT This is…
Harikrishnan
  • 7,765
  • 13
  • 62
  • 113
0
votes
1 answer

LruCache not working with imageAdapter

I'm having 11 images in my resources. I use a GridView to display them. Because images take a lot of space in my ImageAdapter class I calculate sample size and then decode the resouce as per the tutorial here to efficient load an image. Before I…
t0s
  • 1,201
  • 5
  • 19
  • 28
0
votes
1 answer

Android caching network response for certain time limit

I am currently using HttpClient to perform a network request which returns a JSON object. I would like to cache the data that comes back and set an expiration of ten minutes to that cached data. I have looked into using LruCache, SQLite, and shared…
0
votes
1 answer

BitmapFun down sampling my images too aggressively

I am using BitmapFun from the training materials to display my images in a GridView. But the code is returning very blurry images. I tracked one of the culprits to line 184 of class ImageResizer in the method decodeSampledBitmapFromDescriptor.…
learner
  • 11,490
  • 26
  • 97
  • 169
0
votes
1 answer

How do I use android LRU cache with images from my server

I am trying to understand how to use android LRU cache so that I can use it in my app. I have an app that is all about images. One activity displays a GridView of images, another displays a fullscreen image, and besides those two activities images…
learner
  • 11,490
  • 26
  • 97
  • 169
0
votes
1 answer

Using cache to store Bitmaps

I am using LruCache to store Bitmaps. Here is the async task I run to store the bitmap. new AsyncTask() { @Override protected Bitmap doInBackground(Void... args) { String url = d.getImageUrl(); …
jimbob
  • 3,288
  • 11
  • 45
  • 70
0
votes
0 answers

android Lrucache: unable to retrieve cached bitmap

I am able to insert bitmap into LruCache but fails to retrieve previous decoded image. i am having more than 100 images in my db. when i am deoding it my gc mmemory is increasing.so i am implementing this to reuse the decoded image. protected void…
0
votes
1 answer

Android ListView with AsyncTask image issue

I have a ListView which shows some certain contacts from phone book. I use this https://stackoverflow.com/a/10235381/1809507 as Cache class and use AsyncTask. When a contact does not have a photo I use a default one. I set the default one inside…
0
votes
1 answer

Android: keep track of number of objects in cache

I am building a gallery using a ViewPager. Every time a photo is downloaded I immediately cache it in mMemoryCache which is mMemoryCache = new LruCache(cacheSize) { @Override protected int sizeOf(Integer key, Bitmap…
Yotam
  • 9,789
  • 13
  • 47
  • 68
0
votes
1 answer

Image management: When to recycle bitmaps?

I've read When should I recycle a bitmap using LRU Cache and several other questions here, and am still struggling with OutOfMemoryExceptions. But I'm getting ahead of myself. I'm taking over an app that displays a tremendous amount of images.…
Carl Anderson
  • 3,446
  • 1
  • 25
  • 45
0
votes
1 answer

Cannot display full size image in ImagePreview

I have recently modified my Camera to capture and display full-size images,the size on the Galaxy Nexus is 2592 X 1944.I have tried using an LruCache when capturing the image and displaying it in the preview.Where the image should have been there is…
vamsiampolu
  • 6,328
  • 19
  • 82
  • 183
0
votes
1 answer

How to make LruCache only accept key?

LruCache is a map, but I want to use LruCache to only cache strings, i.e. I want LruCache to work as a HashSet. How should I define a LruCache class? LruCache won't work, because when my code called lruCache.put("abc", null),…
Kai
  • 3,775
  • 10
  • 39
  • 54
0
votes
2 answers

How to prevent memory allocation when using an LRUCache?

I'm developing a game for the Android mobile platform, and everything is going great. However, I'm at a point where'd I'd like to address a few problems I've noticed whilst I've been developing and have ignored until now. I'm using an LRUCache to…
Kavan
  • 340
  • 2
  • 12
0
votes
1 answer

Add objects to LRUCache

I want to cache objects of custom claas, which implements serializable using LRUCache in android. It is possible? If yes, how can I proceed to do the same?
Pankaj Deshpande
  • 502
  • 2
  • 5
  • 15