我修改了我的代码并且它的工作成功了,这是我的代码..

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

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐