【问题标题】:Picasso not loading image from Samsung galaxy devices毕加索没有从三星银河设备加载图像
【发布时间】:2016-05-31 15:11:31
【问题描述】:

在 Nexus 和 LG G3 设备(到目前为止我已经尝试过)上,我成功地将设备内存中的图像加载到 ImageView(使用 Picasso)中,如下所示:

mProfileImageView.setOnClickListener(new View.OnClickListener() 
{
    @Override
    public void onClick(View v) {
        Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(Intent.createChooser(intent, "Select Picture"), 2);
    }
});


@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == getActivity().RESULT_OK) {
        Picasso.with(getContext()).setLoggingEnabled(true);
        if (requestCode == 2) {
            Picasso.with(getContext())
                    .load(data.getData())
                    .noPlaceholder()
                    .centerCrop()
                    .fit()
                    .into(mProfileImageView);
        }
    }
}

但是,由于某种奇怪的原因,这在 Galaxy S4 和 S5 上不起作用。

我正在使用毕加索 2.5.2

任何善良的灵魂可以帮助我吗?

提前致谢!

【问题讨论】:

  • 您选择的图片是否很大?尝试使用小图像。还要确保您使用的是最新版本的毕加索。
  • @AliSheikhpour 我正在尝试使用 19KB JPEG,但没有成功
  • 您在调试器上收到任何错误吗?
  • 记录器向我显示此消息两次:E/MiniThumbFile: Unable to create .thumbnails directory /storage/emulated/0/DCIM/.thumbnails
  • 感谢您的帮助。正如我在回答中所说,这是一个许可问题。非常感谢!

标签: android imageview picasso


【解决方案1】:

我*终于*想通了!

这是一个权限问题,因为三星设备使用了外部存储器。将以下行添加到清单后:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

成功了!

【讨论】:

    猜你喜欢
    • 2014-09-26
    • 1970-01-01
    • 2016-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多