ギャラリーから壁紙を設定したいと思います。選択した画像は、デバイスの CropImage クラスを使用する必要があります。
問題は、すべてのデバイスが異なる CropImage クラスを持っているため、「Crop」アクションを使用すると、デバイスの CropImage が開きますが、すべてがウォールパーとして設定されるわけではありません。
コード:
Intent cropperIntent = new Intent("com.android.camera.action.CROP", chosenImageUri);
cropperIntent.setDataAndType(chosenImageUri, "image/*");
cropperIntent.putExtra("crop", true);
cropperIntent.putExtra("aspectX", outSize.x);
cropperIntent.putExtra("aspectY", outSize.y);
cropperIntent.putExtra("outputX", outSize.x);
cropperIntent.putExtra("outputY", outSize.y);
cropperIntent.putExtra("width", outSize.x);
cropperIntent.putExtra("height", outSize.y);
cropperIntent.putExtra("scale", true);
cropperIntent.putExtra("noFaceDetection", true);
cropperIntent.putExtra("set-as-wallpaper", true); // for: com.android.gallery3d.app.CropImage
cropperIntent.putExtra("setWallpaper", true); // for: com.android.camera.CropImage
一部のデバイスでは、壁紙としてまったく設定されていません (HTC など)。「壁紙として設定」や「壁紙として設定」などの別の追加機能を設定する必要があるかもしれません...
すべてのデバイスのクロッパーで壁紙を設定する一般的な方法はありますか?