0

I have very mysterious problem that I am not even sure how to debug.

What I am trying to do in my application is to download Images and present them in a gallery. But from time to time they simply disappears (not all of them). Even when I am not using application. I did not implement removing functionality so far so it can not be anything within application that causes it. Can DownloadManager remove them after a while? I am using BitmapFactory to decodeFiles. Can this be related?

Does any body have a hint where should I look?

thanks

Edit : Just to make it clear. Files are downloaded two ways. One at the very first start , second by service every X minutes. Just to make sure I switched off the service. After initialisations images are there , everything works fine. But after some time (two hours later for example) some of them disappears.

wonglik
  • 1,043
  • 4
  • 18
  • 36
  • Easy enough: check to make sure the file exists on the SD card or where ever you save them to. If they exist, you know the problem is on your side (It likely is, as the DownloadManager simply downloads files and that's it). You should post your code on how you are loading/displaying/caching your images – dymmeh Jan 22 '13 at 19:11
  • @dymmeh Maybe I should edit to make my post clear. Yes they are downloaded. I used Astro file manager to check if they are there. Today it happened twice. Once after two hours. I am glad to post a code but not sure which part. – wonglik Jan 22 '13 at 19:15
  • Always good to rule everything out :) Are you caching your bitmaps once you load them? – dymmeh Jan 22 '13 at 19:26
  • @dymmeh. Yes. I am using LruCache to cache them. – wonglik Jan 22 '13 at 19:33

1 Answers1

0

Does the cache ever become full? Have you checked that the references aren't being garbage collected?

paulczak
  • 96
  • 6
  • Yes it does get full. then the last image in memory is removed and replace with the one being displayed. Why would references and garbage collector matter ? Those are files on a drive not in the memory. – wonglik Jan 22 '13 at 20:47
  • I'm assuming you are displaying the images reading straight from the cache? Once the entry is removed from the cache, it doesn't exist in memory but is still on your sdcard/flash unless you delete the image from it. Try reloading the images you want into the cache. You probably won't be able to store the whole album in main memory, so you may need to figure out how to dynamically repopulate the cache depending on the image being shown at the moment. – paulczak Jan 22 '13 at 21:18
  • If Image is not in the cache it is loaded from the card. This is working fine. Problem is that file disappears. I start suspecting this might be an error in Astro file manager (I am using to remove files when testing fresh start). – wonglik Jan 23 '13 at 08:04