com.android.camera.action.crop uri,在android上使用com.android.camera.action.CROP裁剪保存的图像...
我修改了我的代码并且它的工作成功了,这是我的代码..Intent intent = new Intent("com.android.camera.action.CROP");intent.setType("image/*");List list = getPackageManager().queryIntentActivities( intent, 0 );int size = list.size
我修改了我的代码并且它的工作成功了,这是我的代码..
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setType("image/*");
List list = getPackageManager().queryIntentActivities( intent, 0 );
int size = list.size();
if (size == 0) {
Toast.makeText(this, "Can not find image crop app", Toast.LENGTH_SHORT).show();
return;
} else {
intent.setData(selectImageUri);
intent.putExtra("outputX", 300);
intent.putExtra("outputY", 300);
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("scale", true);
intent.putExtra("return-data", true);
if (size == 1) {
Intent i = new Intent(intent);
ResolveInfo res = list.get(0);
i.setComponent( new ComponentName(res.activityInfo.packageName, res.activityInfo.name));
startActivityForResult(i, CROP_RESULT);
} else {
}
}
和activityResult一样
if (resultCode == RESULT_OK){
switch (requestCode){
case SELECT_PICTURE :
selectImageUri = data.getData();
doCrop();
break;
case CROP_RESULT :
Bundle extras = data.getExtras();
if (extras != null) {
bmp = extras.getParcelable("data");
temporary.setBitmap(bmp);
}
File f = new File(selectImageUri.getPath());
if (f.exists()) f.delete();
Intent inten3 = new Intent(this, tabActivity.class);
startActivity(inten3);
break;
case CAMERA_IMAGE :
doCrop();
break;
}
}
也许它有用:D
更多推荐
所有评论(0)