@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; }
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; } }
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); }
/** {@inheritDoc} */ public SimpleImageLoader(RequestQueue queue) { this(queue, BitmapCache.getInstance(null)); }