Ejemplo n.º 1
0
  @Override
  protected Bitmap doInBackground(String... arg0) {
    // TODO Auto-generated method stub
    if (bitmapReference != null) {}

    Bitmap bm = BitmapCache.getInstance().getBitmap(cookie, url);
    bitmapReference = new WeakReference<Bitmap>(bm);
    return bm;
  }
Ejemplo n.º 2
0
 public Bitmap getPicture() {
   // mPicture is not null only if passed through
   // the ctor which is deprecated by now.
   if (mPicture == null) {
     BitmapCache cache = BitmapCache.getInstance();
     Bitmap picture = cache.getBitmapFromMemCache(mLocation);
     if (picture == null) {
       /* Not in memcache:
        * serving the file from the database and
        * adding it to the memcache for later use.
        */
       Context c = VLCApplication.getAppContext();
       picture = DatabaseManager.getInstance(c).getPicture(c, mLocation);
       cache.addBitmapToMemCache(mLocation, picture);
     }
     return picture;
   } else {
     return mPicture;
   }
 }
Ejemplo n.º 3
0
    public void run() {
      Message msg = new Message();
      msg.arg2 = REQUEST_FRIENDS_TIMELINE;
      try {
        TwitterResponse statuses = twitter.getFriendsTimeline();

        // Load and cache all profile bitmaps
        BitmapCache cache = BitmapCache.getInstance();
        for (int i = 0; i < statuses.getNumberOfItems(); i++)
          cache.load(statuses.getItemAt(i).getUser().getProfileImageURL());

        msg.arg1 = RESPONSE_OK;
        msg.obj = statuses;
      } catch (TwitterConnectionException e) {
        msg.arg1 = RESPONSE_CONN_KO;
        msg.obj = e;
      } catch (Exception e) {
        msg.arg1 = RESPONSE_KO;
        msg.obj = e;
      }
      handler.sendMessage(msg);
    }
Ejemplo n.º 4
0
 /** {@inheritDoc} */
 public SimpleImageLoader(RequestQueue queue) {
   this(queue, BitmapCache.getInstance(null));
 }