第8章相册中选择照片后进入不了裁剪界面,查看Gallery中的ImageGallery.java源码部分:
private void launchCropperOrFinish(IImage img) {
Bundle myExtras = getIntent().getExtras();
long size = MenuHelper.getImageFileSize(img);
if (size < 0) {
// Return if the image file is not available.
return;
}
if (size > mVideoSizeLimit) {
DialogInterface.OnClickListener buttonListener =
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
};
new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_dialog_info)
.setTitle(R.string.file_info_title)
.setMessage(R.string.video_exceed_mms_limit)
.setNeutralButton(R.string.details_ok, buttonListener)
.show();
return;
}
String cropValue = myExtras != null ?
myExtras.getString("crop") : null;
从源代码可以看出“crop”从bundle中获取
将
intent.putExtra("crop", true);
改为
Bundle bundle=new Bundle();
bundle.putString("crop","true");
intent.putExtras(bundle);