在我的onActivityResult中,我有两个if语句,一个是从图库中获取图片,另一个是从相机中获取图片。在我获得图片uri后,它启动adobe creative sdk来编辑图像。获得编辑后的图像后,我想开始将已编辑的图像传递给另一个活动。
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//Gets the gallery image uri
if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) {
Uri selectedImage = data.getData();
String[] filePathColumn = {MediaStore.Images.Media.DATA};
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
editPic(selectedImage);
}
//gets Camera pic taken uri
if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
// Image captured and saved to fileUri specified in the Intent
Uri mpicTaken = data.getData();
editPic(mpicTaken);
} else if (resultCode == RESULT_CANCELED) {
// User cancelled the image capture
} else {
// Image capture failed, advise user
}
}
//edited image
Uri editedImageUri = data.getData();
/*
Intent intent = new Intent("com.ayyogames.photoapp.Share");
intent.putExtra("imageUri", editedImageUri);
startActivity(intent);
*/
}
public void editPic(Uri uri) {
Intent intent = new AdobeImageIntent.Builder(this)
.setData(uri)
.withOutputSize(MegaPixels.Mp10)
.withOutputQuality(100)
.build();
startActivityForResult(intent, IMG_CODE_EDIT);
}
答案 0 :(得分:0)
您可以将Uri存储为字符串,如
my_dict = {1:4, 2: 9, 3: 17, 4: 27, 5: 51, 6: 129, 7: 285, 8: 533}
然后在新活动中,将其转换回来
intent.putExtra("imageUri", editedImageUri.toString());