gpt4 book ai didi

android - 在 Android 代码中获取运行时错误 'image uri must be of the content scheme type'

转载 作者:行者123 更新时间:2023-11-29 02:25:28 24 4
gpt4 key购买 nike

我正在从 Android 导出一个模块以用于 React-Native 应用程序。我想从 React-Native 应用程序设置壁纸。

因此,我在 Android 的导出模块中编写了以下代码。

public void setNewWallpaperFromUrl(String path) {
context = getReactApplicationContext();
WallpaperManager wpm = WallpaperManager.getInstance(context);
try {
//InputStream ins = new URL(path).openStream();
//path="https://res.cloudinary.com/dwgtksajb/image/upload/v1536237557/wallpaper/Nature/1536237557101_readtrip.jfif.jpg"
wpm.getCropAndSetWallpaperIntent(Uri.parse(path));
} catch (Exception ex) {
throw ex;
}
}

编译成功。但是在运行时我收到一个错误:'image URI must be of the content scheme type'

非常感谢任何快速帮助。

最佳答案

我从Android官方文档中得到了答案。getCropAndSetWallpaperIntent(Uri uri) 方法仅排除“内容”方案 uri。

请访问enter link description here

获取更多信息。

关于android - 在 Android 代码中获取运行时错误 'image uri must be of the content scheme type',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52496818/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com