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
0 answers

Why does the bitmap from the cache in the folllowing code return null?

The following code should be caching image into the memory but every time I run it the cache always return null. What could be the issue? I have used the code as exactly as it is on the Android Developer website. private lateinit var memoryCache:…
ronnieotieno
  • 134
  • 2
  • 11
0
votes
1 answer

LruCache not storing bitmap in kotlin Android

I am simply trying to cache bitmap into LruCache HashMap by doing this: private lateinit var cacheStock: LruCache private lateinit var cacheStock: LruCache var maxCacheSize: Int = (Runtime.getRuntime().maxMemory() /…
Ali Akram
  • 4,803
  • 3
  • 29
  • 38
0
votes
1 answer

how to avoid getting the "android.os.TransactionTooLargeException"

In the android app there are cases need to pass some data around, crossing activity/fragment, pass to service etc. It has been using the parcelable and put in the intent/bundle. It works fine except get crash on over the one meg limit of the…
lannyf
  • 9,865
  • 12
  • 70
  • 152
0
votes
1 answer

How do I cache content and data from a json API using Rx2AndroidNetworking?

I am retrieving my response from my API with rxjava with funcs as follows: @Override public Single getMyInfoApiCall() { return Rx2AndroidNetworking.get(ApiEndPoint.ENDPOINT_MY_INFO) …
user2386226
0
votes
3 answers

Using LruCache: Is cache attatched to a LruCache instance?

I might just be confused about how LruCache is supposed to work, but are does it not allow accessing objects from one instance that were saved on another instance? Surely this is not the case otherwise it kind of defeats the purpose of having…
John Sardinha
  • 3,566
  • 6
  • 25
  • 55
0
votes
1 answer

Accessing cached Images from LruCache Implementation

I have a GridView with images and i have populated it using Volley and cached the images using the below links. I want to access the selected image of GridView in a new activity from the cached implementation. I have searched here on StackOverflow…
Affan Mirza
  • 107
  • 2
  • 10
0
votes
2 answers

Android - Laggy ListView with ImageView, LRUcache and ViewHolder

I have a ListView in which every row has some text and two ImageView: one is the same for every row, the other depends on the current item. This is my adapter: mArrayAdapter(Context context, int layoutResourceId, ArrayList data) { …
tuzzo
  • 75
  • 1
  • 1
  • 10
0
votes
2 answers

ViewPager and ListView Cache

I have a ViewPager with 4 ListViews.The list views all download unique Images and I want to cache them but there is an error and the app works very slow. Is there a way to cache all images in 1 LruCache or something like that? This is my code so…
user8966147
0
votes
0 answers

Remove LruCache when running Instrumentation tests using Espresso

I am running espresso tests and want to remove the LruCache on each test run. I am able to do so for preferences: @Before @After public void clearSharedPrefs() { SharedPreferences settings =…
Shubham
  • 2,627
  • 3
  • 20
  • 36
0
votes
1 answer

Passing large text-data through intent. How to cache it?

I'm passing some data to DatabaseService through an Intent. However there is a corner case of one user when this data is really huuuge. And I get E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! Bummer. Normally people assume that I try to pass a…
a_dzik
  • 927
  • 2
  • 11
  • 24
0
votes
1 answer

Out of memory with LruCache?

In last line I get a crash: InputStream in = new BufferedInputStream(new FileInputStream(file)); byte[] buf = new byte[(int) file.length()]; int numRead = in.read(buf); final Bitmap bitmap = BitmapFactory.decodeByteArray(buf, 0, numRead); <---…
János
  • 32,867
  • 38
  • 193
  • 353
0
votes
1 answer

LRUCACHE in custom gridview

hi I am using custom gridView contain imageview and 2 textFields in my program, In getview method i'm am using image fetch from internet using url to show images in imageview. i need to use lrucache to show images without storing the downloaded…
0
votes
1 answer

Is the LruCache constrained by the Android app memory space?

I'm looking at the docs and trying to understand if the LruCache is competing for heap resources with the rest of my app or if it's actually using some sort of elaborate disk swapping mechanism. The reason I'm asking is that I want to allocate a lot…
Yevgeny Simkin
  • 27,946
  • 39
  • 137
  • 236
0
votes
1 answer

LRU Cache: initialize only one for the entire app?

In my app I have different list view that contains some thumbnails. Today I'm starting the refactoring and I want to implement the LRU Caching. I'm following the Android guide lines, but I'm wondering if is better to initialize only one LRU Cache…
aeroxr1
  • 1,014
  • 1
  • 14
  • 36
0
votes
1 answer

NetworkImageView caches resized image rather than original

I’ve been dipping my feet into the world of Android development and I’ve been using Volley and LruCache to put together a basic news reader app. I have a recycler view where each cell contains a NetworkImageView from the Volley library. I can tap…