Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/183.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
获取运行时错误';图像uri必须为内容方案类型';在Android代码中_Android_React Native - Fatal编程技术网

获取运行时错误';图像uri必须为内容方案类型';在Android代码中

获取运行时错误';图像uri必须为内容方案类型';在Android代码中,android,react-native,Android,React Native,我正在从Android导出一个模块,用于React原生应用程序。 我想从React本机应用程序设置壁纸 因此,我在Android的导出模块中编写了以下代码 public void setNewWallpaperFromUrl(String path) { context = getReactApplicationContext(); WallpaperManager wpm = WallpaperManager.getInstance(context); try {

我正在从Android导出一个模块,用于React原生应用程序。 我想从React本机应用程序设置壁纸

因此,我在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;
    }
}
它编译成功。但在运行时我得到一个错误:“图像URI必须是内容方案类型”


非常感谢您的快速帮助。

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

请访问


更多信息。

我从Android官方文档中得到了答案。