Created
October 21, 2016 14:08
-
-
Save CMingTseng/5b44033cc605b8297624d32b2f3cdfa2 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
//http://stackoverflow.com/questions/32949914/try-to-fetch-bitmap-from-uri-using-fresco | |
ImageRequest imageRequest = ImageRequestBuilder | |
.newBuilderWithSource(mImageCaptureUri) | |
.setAutoRotateEnabled(true) | |
.build(); | |
ImagePipeline imagePipeline = Fresco.getImagePipeline(); | |
final DataSource<CloseableReference<CloseableImage>> | |
dataSource = imagePipeline.fetchDecodedImage(imageRequest, this); | |
dataSource.subscribe(new BaseBitmapDataSubscriber() { | |
@Override | |
public void onNewResultImpl(@Nullable Bitmap bitmap) { | |
if (dataSource.isFinished() && bitmap != null){ | |
Log.d("Bitmap","has come"); | |
bmp = Bitmap.createBitmap(bitmap); | |
dataSource.close(); | |
} | |
} | |
@Override | |
public void onFailureImpl(DataSource dataSource) { | |
if (dataSource != null) { | |
dataSource.close(); | |
} | |
} | |
}, CallerThreadExecutor.getInstance()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment