fresco icon indicating copy to clipboard operation
fresco copied to clipboard

BaseBitmapDataSubscriber not work T_T

Open chonamdoo opened this issue 11 years ago • 2 comments

ImagePipeline imagePipeline = Fresco.getImagePipeline(); ImageRequest imageRequest = ImageRequestBuilder .newBuilderWithSource(Uri.fromFile(new File(customBG.get(0)))) .setAutoRotateEnabled(false) .setLocalThumbnailPreviewsEnabled(true) .setLowestPermittedRequestLevel(ImageRequest.RequestLevel.FULL_FETCH) .setProgressiveRenderingEnabled(false) .setResizeOptions(new ResizeOptions(width, height)) .build(); DataSource <CloseableReference> dataSource = imagePipeline.fetchDecodedImage(imageRequest, getAppContext()); dataSource.subscribe(new BaseBitmapDataSubscriber() { @Override protected void onNewResultImpl(@Nullable Bitmap bitmap) { LogUtils.v("DEBUG91", "onNewResultImpl : " + bitmap); }

            @Override
            protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
                LogUtils.v("DEBUG91", "onFailureImpl");
            }
        }, new Executor() {
            @Override
            public void execute(Runnable command) {
                LogUtils.v("DEBUG91", "Executor : " + command.toString());
            }
        });

chonamdoo avatar Mar 31 '15 07:03 chonamdoo

Of course it's not working. You need to provide an actual executor to be used for callbacks. Once the data source finishes, we will call your callback on the provided executor. The executor you provided does nothing. See our CallerThreadExecutor.getInstance() or UiThreadExecutorService.getInstance()

Please read the documentation of: http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executor.html

Unrelated thing, callerContext is not Android context, it's the tag/object that you can use for instrumentation (use null if you don't need it). Therefore you should not pass getAppContext there.

plamenko avatar Mar 31 '15 14:03 plamenko

Thank you for answer thx

2015-03-31 23:09 GMT+09:00 Ognjen Dragoljevic [email protected]:

Of course it's not working. You need to provide an actual executor to be used for callbacks. Once the data source finishes, we will call your callback on the provided executor. The executor you provided does nothing. See our CallerThreadExecutor.getInstance() or UiThreadExecutorService.getInstance()

Please read the documentation of: http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executor.html

Unrelated thing, callerContext is not Android context, it's the tag/object that you can use for instrumentation (use null if you don't need it). Therefore you should not pass getAppContext there.

— Reply to this email directly or view it on GitHub https://github.com/facebook/fresco/issues/49#issuecomment-88101582.

chonamdoo avatar Mar 31 '15 14:03 chonamdoo