I am getting this error when using getCropAndSetWallpaperIntent()
in android
D/Exception: java.lang.IllegalArgumentException: Cannot use passed URI to set wallpaper; check that the type returned by ContentProvider matches image/*
But when I check for the type of Content
using ContentResolver
I am getting
D/CONTENT TYPE:: IS: image/jpeg
then why is Wallpaper Manager
is giving me content error ?
Here is the code I am using to get Image URI
public Uri getImageUri(Context inContext, Bitmap inImage) {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
tempPath = MediaStore.Images.Media.insertImage(inContext.getContentResolver(), inImage, "Title", null);
Log.d("URI OF SET IMAGE", tempPath);
ContentResolver cr = this.getContentResolver();
Log.d("CONTENT TYPE: ", "IS: " + cr.getType(Uri.parse(tempPath)));
return Uri.parse(tempPath);
}
Any ideas ?