调用系统代码裁剪照片-创新互联
没什么好说的就直接上代码吧
分享标题:调用系统代码裁剪照片-创新互联
文章位置:http://cdiso.cn/article/cdjoee.html
1 public void cropImage(View view){
2 Intent intent = new Intent();
3
4 Bundle myExtras = new Bundle();
5 myExtras.putBoolean("return-data", true);
6 intent.putExtras(myExtras);
7
8
9 intent.setAction("com.android.camera.action.CROP");
10 intent.addCategory("android.intent.category.DEFAULT");
11 // intent.setData(Uri.fromFile(new File("sdcard/img.JPG")));
12 // intent.setType("image/*");13 intent.setDataAndType(Uri.fromFile(new File("sdcard/img.JPG")),"image/*");
14 startActivityForResult(intent, 0);
15 }
16
17 @Override
18 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
19 if(data!=null){
20 Parcelable imagedata = (Parcelable) data.getExtras().get("data");
21 iv.setImageBitmap((Bitmap) imagedata);
22
23 }
24 super.onActivityResult(requestCode, resultCode, data);
25 }
分享标题:调用系统代码裁剪照片-创新互联
文章位置:http://cdiso.cn/article/cdjoee.html