【问题标题】:Showing Can't load the image显示无法加载图片
【发布时间】:2018-08-29 06:57:07
【问题描述】:

我正在尝试从 Internet 下载图像并将其传递到设备的默认裁剪器,但它显示无法加载图像。

我的代码是:

Intent cropApps = new Intent("com.android.camera.action.CROP");
cropApps.setType("image/*");
List<ResolveInfo> list = this.getPackageManager().queryIntentActivities(cropApps, 0);
int size = list.size();
if (size == 0)
{
    Toast.makeText(this, "Can not find image crop app", Toast.LENGTH_SHORT).show();
}
else
{
    Uri picUri = Uri.parse("https://www.irononsticker.com/images/Doraemom43.jpg");
    ResolveInfo res = list.get(0);
    Intent cropIntent = new Intent();
    cropIntent.setClassName(res.activityInfo.packageName, res.activityInfo.name);
    cropIntent.setDataAndType(picUri, "image/*");
    cropIntent.putExtra("outputX", 800);
    cropIntent.putExtra("outputY", 800);
    cropIntent.putExtra("aspectX", 1);
    cropIntent.putExtra("aspectY", 1);
    cropIntent.putExtra("scale", true);
    cropIntent.putExtra("return-data", true);
    startActivity(cropIntent);

【问题讨论】:

标签: android image cropper


【解决方案1】:

您需要做的是转到文件,单击属性,然后复制位置。 示例:(r'C:\Users\Owner\Downloads\game\yourimagename.png') 您注意到粘贴位置后,输入“\”并单击所需的文件。

希望对你有帮助

【讨论】:

  • 您好,欢迎来到 StackOverflow!我确定您想提供帮助,但我相信这并不是作者的真正想法。如果您仔细查看,似乎应该从特定的 URI 下载图像,而不是从系统文件加载。请考虑更新您的答案以使其更有帮助。如果您不知道问题的答案,请考虑将其删除。干杯!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-08-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-07-18
  • 2020-09-17
相关资源
最近更新 更多