Created
November 29, 2016 15:13
-
-
Save chethann/722f30745eda5b74f78c44f1f2dcdaba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
CacheKey cacheKey = new SimpleCacheKey(url); | |
ByteArrayOutputStream stream = new ByteArrayOutputStream(); | |
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream); | |
final byte[] byteArray = stream.toByteArray(); | |
Fresco.getImagePipelineFactory().getMainDiskStorageCache().insert(cacheKey, new WriterCallback() { | |
@Override | |
public void write(OutputStream outputStream) throws IOException { | |
outputStream.write(byteArray); | |
} | |
}); | |
} catch (IOException cacheWriteException) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment