Example #1
0
    private void setBitmapDrawable(InputStream input) {
      Bitmap bitmap = null;
      try {
        bitmap = getBitmap(input);

        if (bitmap == null || bitmap.getHeight() < 1 || bitmap.getWidth() < 1) {
          return;
        }

      } catch (OutOfMemoryError outofmem) {
        LOG.error("Could not load image", outofmem);
        clearImageCache();
      }

      if (bitmap != null) {

        FastBitmapDrawable drawable = new FastBitmapDrawable(bitmap);

        drawable.setBounds(0, 0, bitmap.getWidth() - 1, bitmap.getHeight() - 1);
        setImageSpan(builder, drawable, start, end);

        LOG.debug("Storing image in cache: " + storedHref);

        imageCache.put(storedHref, drawable);
      }
    }