Code example for ExecutorService

Methods: execute

0
    private void cacheBitmapToMemory(final String url, final Bitmap bitmap) {
        memoryCache.put(getCacheKey(url), new SoftReference<Bitmap>(bitmap));
    } 
 
    private void cacheBitmapToDisk(final String url, final Bitmap bitmap) {
        writeThread.execute(new Runnable() {
            @Override 
            public void run() { 
                if(diskCacheEnabled) {
                    BufferedOutputStream ostream = null;
                    try { 
                        ostream = new BufferedOutputStream(new FileOutputStream(new File(diskCachePath, getCacheKey(url))), 2*1024);
                        bitmap.compress(CompressFormat.JPEG, 90, ostream);
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    } finally { 
                        try { 
                            if(ostream != null) {
                                ostream.flush();
                                ostream.close();
                            }