'u kullanarak kullanarak Bitmap
getirirken davranışı anlamayın. Kodumu hata ayıkladığında, onNewResultImpl
veya onFailureImpl
yürütüyor ve uygulama çalışmıyorsa, onFailureImpl
veya onNewResultImpl
(uygulama çalıştırılırken Toast
ve Log
kullanarak kontrol ediyorum) anlamına gelmiyor demektir. Bu SO Question and take ref from it ve ayrıca from Fresco's
doc.uri kullanarak bitmap'i Fresco kullanarak alınmaya çalışın
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK) {
switch (requestCode) {
case ACTION_OPEN_GALLERY:
mImageCaptureUri = data.getData();
if (mImageCaptureUri != null) {
commentImgView.setImageURI(mImageCaptureUri);//mImageCaptureUri is working fine
try {
imageRequest = ImageRequestBuilder
.newBuilderWithSource(mImageCaptureUri)
.setRequestPriority(Priority.HIGH)
.setLowestPermittedRequestLevel(ImageRequest.RequestLevel.FULL_FETCH)
.build();
dataSource = imagePipeline.fetchDecodedImage(imageRequest, CommentActivity.this);
dataSource.subscribe(new BaseBitmapDataSubscriber() {
@Override
protected void onNewResultImpl(@Nullable Bitmap bitmap) {
if (bitmap != null) {
bmp = Bitmap.createBitmap(bitmap);
Log.d("Bitmap ","after callback");
Toast.makeText(CommentActivity.this,"has bitmap",Toast.LENGTH_SHORT).show();
} else {
Log.d("Bitmap is null ","after callback");
Toast.makeText(CommentActivity.this,"bitmap is null",Toast.LENGTH_SHORT).show();
}
}
@Override
protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
Log.d("Bitmap ","after callback failure");
Toast.makeText(CommentActivity.this,"Failure",Toast.LENGTH_SHORT).show();
}
}, CallerThreadExecutor.getInstance());
} catch (Exception e){
e.printStackTrace();
} finally {
if (dataSource != null) {
dataSource.close();
}
}
}
}
}
}
Not gördük: Ben try
ve finally
blok ve ve kapanış kaldırdık
etkisiz –
için' imageRequest, imagePipeline ve dataSource 'ilan deneyin? Doğru değerler aldığınızdan emin olun – kId
Eğer 'data' değişken hangi değerler içermiyor son kütüphane dosyaları ve kavanoz dosyaları –