呼叫外部裁切功能
因為需要裁切功能,但又不想自己刻一個(我自己也不會刻)
所以呼叫外部應用程式處理(Google 手機基本應該是會有)
使用以下程式碼,就可以處理
private Uri tempFileUri = null;
private void cropImageUri(Uri paramUri) {
Intent localIntent = new Intent("com.android.camera.action.CROP");
localIntent.setDataAndType(paramUri, "image/*");
localIntent.putExtra("noFaceDetection", true);
localIntent.putExtra("crop", "true");
localIntent.putExtra("aspectX", 1);
localIntent.putExtra("aspectY", 1);
localIntent.putExtra("outputX", 600);
localIntent.putExtra("outputY", 600);
localIntent.putExtra("scale", true);
String paramUri2 = getSupportPath();
this.tempFileUri = Uri.parse("file:///" + paramUri2 + "/" + new Date().getTime() + ".jpg");
localIntent.putExtra("output", this.tempFileUri);
localIntent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
startActivityForResult(localIntent, CROP_IMAGE);
}
public String getSupportPath()
{
if (("mounted".equals(Environment.getExternalStorageState())) || (!Environment.isExternalStorageRemovable())) {
return getExternalCacheDir().getPath();
}
return getCacheDir().getPath();
}