android-lru-cache

FFmpeg output seeking result to Android LruCache

我是研究僧i 提交于 2019-12-10 10:55:53
问题 Dear fellow StackOverflower, In my Android application, I'm trying to quickly retrieve a frame from a video using ffmpeg-android-java to display in an ImageView . The problem is using a typical ffmpeg 's -ss seeking command will require to write the output into the memory which I suppose is the big hit on performance: ffmpeg -ss 00:23:00 -i Mononoke.Hime.mkv -frames:v 1 out1.jpg A typical command execution like above takes around 700 - 1200 milliseconds. So instead of writing into the memory,

Memory-Leaks Image-Gallery Android - How can other applications handle it?

江枫思渺然 提交于 2019-12-08 18:21:22
i'm trying to implement a image gallery, which should show ~ 5-15 smaller images and one "current selected" bigger image. It looks like: http://www.mobisoftinfotech.com/blog/wp-content/uploads/2012/06/galleryDemo.png I've looked up many sources and now decided to use a bitmap-cache (lru-cache) (thanks to a person from this forum!). I don't get memory-leaks at the moment, but i'm not happy with this solution because everytime i scroll, some images are removed from the cache and i've to reload them... so the user has to wait for reloading images... It's really annoying to wait 0.5 - 1 second

Memory-Leaks Image-Gallery Android - How can other applications handle it?

允我心安 提交于 2019-12-08 07:12:21
问题 i'm trying to implement a image gallery, which should show ~ 5-15 smaller images and one "current selected" bigger image. It looks like: http://www.mobisoftinfotech.com/blog/wp-content/uploads/2012/06/galleryDemo.png I've looked up many sources and now decided to use a bitmap-cache (lru-cache) (thanks to a person from this forum!). I don't get memory-leaks at the moment, but i'm not happy with this solution because everytime i scroll, some images are removed from the cache and i've to reload

Implementing a global LruCache vs many local LruCaches

淺唱寂寞╮ 提交于 2019-12-08 04:13:21
问题 Several Activity s in my app display images in a ListView where each row of the ListView contains an ImageView . An example of this would be a search screen where the user searches, gets results, and a picture of each result is shown. I'm trying to weigh the cost/benefits of implementing a global LruCache vs having each Activity contain its own local LruCache . Here are my two main problems. Both revolve around the fact that my app is quite large, meaning there are quite a few screens which

caching images with LruCache

為{幸葍}努か 提交于 2019-12-06 04:19:51
I am trying to use LruCache in android to cache some images, but its not caching here is the code int cacheSize1 = 4 * 1024 * 1024; // 4MiB bitmapCache = new LruCache(cacheSize1) { protected int sizeOf(String key, Bitmap value) { return value.getRowBytes() * value.getHeight(); }}; here its other methods public void addBitmapToMemoryCache(String key, Bitmap bitmap) { if (getBitmapFromMemCache(key) == null) { bitmapCache.put(key, bitmap); } } public Bitmap getBitmapFromMemCache(String key) { Bitmap b = (Bitmap)bitmapCache.get(key); return b; } here I am using them this is my code for (int i = 0;

How to prevent Out of memory error in LRU Caching android

风格不统一 提交于 2019-12-04 15:50:02
问题 I have used Memory LRU Caching for caching bitmaps in my android application.but after some of the bitmaps are loaded into LRU map app force closes saying out of memory exception. I have spent whole day behind this but yet not found the solution please anyone can help me out I am badly stuck in this problem.Thanks in advance. HERE IS MY CODE final int maxMemory = (int) (Runtime.getRuntime().maxMemory()/1024); final int cacheSize = maxMemory / 8; bitmapHashMap = new LruCache<String, Bitmap>

How to prevent Out of memory error in LRU Caching android

六月ゝ 毕业季﹏ 提交于 2019-12-03 08:59:10
I have used Memory LRU Caching for caching bitmaps in my android application.but after some of the bitmaps are loaded into LRU map app force closes saying out of memory exception. I have spent whole day behind this but yet not found the solution please anyone can help me out I am badly stuck in this problem.Thanks in advance. HERE IS MY CODE final int maxMemory = (int) (Runtime.getRuntime().maxMemory()/1024); final int cacheSize = maxMemory / 8; bitmapHashMap = new LruCache<String, Bitmap>(cacheSize) { @SuppressLint("NewApi") @Override protected int sizeOf(String key, Bitmap value) { if

Is it possible to change the size of the cache Picasso uses for images?

旧时模样 提交于 2019-11-30 16:48:45
I'm loading images from URLs (http://) with Picasso. Sometimes when i try to "preload" an image using Picasso's fetch() method, the image doesn't get cached. I guess it's because it's size is too big. Read the answer for this question, but setCache() doesn't seem to be recognized for me, i don't even find it in the Picasso documentation. Is there any way to change the cache size Picasso uses for bitmaps? You can do: int maxSize = MAX_CACHE_SIZE; Picasso picasso = new Picasso.Builder(context) .memoryCache(new LruCache(maxSize)) .build(); Picasso uses a Cache interface type to manage the cache.

Is it possible to change the size of the cache Picasso uses for images?

社会主义新天地 提交于 2019-11-30 16:11:16
问题 I'm loading images from URLs (http://) with Picasso. Sometimes when i try to "preload" an image using Picasso's fetch() method, the image doesn't get cached. I guess it's because it's size is too big. Read the answer for this question, but setCache() doesn't seem to be recognized for me, i don't even find it in the Picasso documentation. Is there any way to change the cache size Picasso uses for bitmaps? 回答1: You can do: int maxSize = MAX_CACHE_SIZE; Picasso picasso = new Picasso.Builder

Example using Androids lrucache

有些话、适合烂在心里 提交于 2019-11-27 10:52:27
I need help understanding androids LruCache. I want to use to load images into my gridview in order make the loading/scrolling better. Can someone post an example code using LruCache please. Thanks in advance. ePeace Below is a class I made for using LruCache, this is based on the presentation Doing More With Less: Being a Good Android Citizen given at Google I/O 2012 . Check out the movie for more information about what I'm doing in the TCImageLoader class: public class TCImageLoader implements ComponentCallbacks2 { private TCLruCache cache; public TCImageLoader(Context context) {