我試圖使用getCropAndSetWallpaperIntent方法,但我得到一個錯誤。如何使用getCropAndSetWallpaperIntent?
這裏是我的代碼:
Uri uri = Uri.parse("content://" + getFilesDir() + "/"+ image.path);
ContentResolver contentResolver = getContentResolver();
contentResolver.getType(uri); // Type is null
Intent intent = wallpaperManager.getCropAndSetWallpaperIntent(uri);
intent.setType("image/*");
startActivityForResult(intent, 42);
以下是我在我的日誌有:
java.lang.IllegalArgumentException: Cannot use passed URI to set wallpaper; check that the type returned by ContentProvider matches image/*
你能幫助我嗎?
弄來的解決方案? – user4057066