I'm kind of new in android developing and i want to set home wallpaper with drawable image . i wrote this code for setting but don't work and in visual android device at first i have dialog but next when i click as background i get this message :
"you need to insert sd card before using camera ..."
also i need use my drawable as source of images ... here is my code :
Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
MimeTypeMap map = MimeTypeMap.getSingleton();
String mimeType = map.getMimeTypeFromExtension("jpg");
Uri uri = Uri.parse("@drawable/wall_7");
intent.setDataAndType(uri,"image/jpeg" );
intent.putExtra("mimeType", mimeType);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
this.startActivityForResult(Intent.createChooser(intent,"Set as"),200);
and i going to have a slidable wallpaper , not a fix image . i'm using this intent bcs it let user crop image .