我现在面临一个问题,当进入裁剪功能时,我的 Galaxy nexus 不断循环“加载图像”。下面是我的编码:
Intent openCamera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(openCamera, click_camera);
protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent){
if (imageReturnedIntent != null)
{if(requestCode == click_camera && resultCode == RESULT_OK) {
picUri = imageReturnedIntent.getData();
Crop();
}
else {
**my coding part**
}
/* crop method */
private void Crop(){
try {
//call the crop action from intent (default from device)
Intent cropIntent = new Intent("com.android.camera.action.CROP");
//indicate image type and Uri
cropIntent.setDataAndType(picUri, "image/*");
//set crop properties
cropIntent.putExtra("crop", "true");
//indicate aspect of desired crop
cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
//indicate output X and Y
cropIntent.putExtra("outputX", 300);
cropIntent.putExtra("outputY", 300);
cropIntent.putExtra("scale", true);
cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, getTempUri());
cropIntent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
//retrieve data on return
cropIntent.putExtra("return-data", true);
//start the activity - we handle returning in onActivityResult
startActivityForResult(cropIntent, PIC_CROP);
}
//respond to users whose devices do not support the crop action
catch(ActivityNotFoundException anfe){
//display an error message
String errorMessage = "Whoops - your device doesn't support the crop action!";
Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT);
toast.show();
}
}
是我的裁剪功能错误吗?任何人都可以帮助解决问题吗?