android - File browser out of memory -


i trying load thumbnails videos in file browser causing me run out of memory.

public class filea {  private bitmap videoicon;  public bitmap getvideoicon() {     return videoicon; }  public void setvideoicon(bitmap videoicon) {     videoicon = videoicon; } 

this being done every video file in folder.

every time load new folder keep information previous folder, , if how delete unwanted resources?

private list<filea> loadfiles(string dirpath)  {     insearch = false;     list<filea> files = new arraylist<filea>();      try {     for(string f:editedfilelist(current)) {         filea file = new filea();      file.setvideoicon(thumbnailutils.createvideothumbnail(current + "/" + getname(f), mediastore.images.thumbnails.mini_kind));         files.add(file);        }     } catch (nullpointerexception e) {         e.getstacktrace();     } catch (nosuchelementexception e) {         log.i("loadfiles", "no files found");     }     return files;  } 

this how information obtained.

along video thumbnails loading other bits of data e.g. file name, size, permissions, image icons(as bitmaps) ect..

most you're keeping around bunch of unneeded references. suggestion put images in lrucache , load them there. way can set reasonable maximum amount of memory use on images.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -