예제 #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;
  }
예제 #2
0
파일: Media.java 프로젝트: vyloy/lnvc
 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;
   }
 }
예제 #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);
    }
예제 #4
0
 /** {@inheritDoc} */
 public SimpleImageLoader(RequestQueue queue) {
   this(queue, BitmapCache.getInstance(null));
 }