【问题标题】:How to load JPEG as a BITMAP from server using Picasso如何使用 Picasso 从服务器加载 JPEG 作为 BITMAP
【发布时间】:2014-09-23 17:30:39
【问题描述】:

我试过用这个方法:

bmp = (Bitmap) Picasso.with(Feed.this).load(IMAGE_URL+loadImageUrl).resize(width, width).get();

但即使我取出(位图)类型转换,我也会收到“Picasso DownloadResponseException”

我也试过了:

Picasso.with(Feed.this).load(IMAGE_URL+image).resize(width, width).into(target);

private Target target = new Target() {

    @Override
    public void onBitmapFailed(Drawable arg0) {
        // TODO Auto-generated method stub
        Log.d("FAILED", "Bitmap Failed");
    }

    @Override
    public void onPrepareLoad(Drawable arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onBitmapLoaded(Bitmap bmp, LoadedFrom arg1) {

        RoundedCornersDrawable drawable = new RoundedCornersDrawable(getResources(), bmp);
        theImage.setImageDrawable(drawable);

    }
};

但它什么也没给我,图像没有加载它只是保持空白,并且 BitmapFailed 方法下的日志消息没有出现......存储在我的服务器上的图像类型为“jpg”。

请帮帮我

【问题讨论】:

    标签: android bitmap imageview remote-server picasso


    【解决方案1】:

    想通了。原来我有错误的网址。还要确保不要在 UI 线程中调用 Picasso.get() 方法...

    【讨论】:

      猜你喜欢
      • 2016-09-26
      • 1970-01-01
      • 1970-01-01
      • 2016-10-31
      • 1970-01-01
      • 2023-01-17
      • 2014-03-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多