Beispiel #1
0
 public Bitmap loadCachedResource(CachedResource resource) {
   try {
     Options options = new Options();
     options.inPurgeable = true;
     options.inInputShareable = true;
     return BitmapFactory.decodeStream(
         new FlushedInputStream(new FileInputStream(new File(resource.getPath()))));
   } catch (Exception e) {
     if (resource != null) {
       Log.e("MyTag", "Error decoding image : " + resource.getPath(), e);
     }
     System.gc();
     return null;
   }
 }
Beispiel #2
0
 public Bitmap loadCachedResourceWithDimensions(
     CachedResource resource, int desiredBitmapWidth, int desiredBitmapHeight) {
   try {
     Options options = new Options();
     return createScaledBitmapFromStream(
         new FlushedInputStream(new FileInputStream(new File(resource.getPath()))),
         desiredBitmapWidth,
         desiredBitmapHeight);
   } catch (Exception e) {
     return null;
   }
 }