无法使用Picasso将位图下载到目标?

时间:2015-09-05 05:09:29

标签: android picasso

我正在尝试将位图加载到arraylist,如下所示:

 Picasso.with(context).load(url).into(new Target(){

        @Override
        public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
            //mainLayout.setBackground(new BitmapDrawable(context.getResources(), bitmap));
            photos.add(bitmap);
        }

        @Override
        public void onBitmapFailed(final Drawable errorDrawable) {
            Log.d("TAG", "FAILED");
        }

        @Override
        public void onPrepareLoad(final Drawable placeHolderDrawable) {
            Log.d("TAG", "Prepare Load");
        }
    });

但为什么onBitmapLoaded方法永远不会被调用?

1 个答案:

答案 0 :(得分:0)

毕加索,并没有强烈引用new Target()它将被垃圾收集

查看this