简体   繁体   中英

Crop Image from drawable folder

am working with wallpaper app. In this i add some images in drawable folder and displays in gridview. When user selects one, i need to crop that image and set as wallpaper as per in android default wallpaper setting . Searching a lot but all those contains croping image from sdcard. Please give me any suggestion.

Thanks.

try this way:

Uri imgUri=Uri.parse("android.resource://your.package.name/"+R.drawable.image);
 Intent intent = new Intent("com.android.camera.action.CROP");  
        intent.setDataAndType(imgUri, "image/*");  
        intent.putExtra("crop", "true");  
        intent.putExtra("aspectX", 1);  
        intent.putExtra("aspectY", 1);  
        intent.putExtra("outputX", 80);  
        intent.putExtra("outputY", 80);  
        intent.putExtra("return-data", true);
        startActivityForResult(intent, 1);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM