I want to open a photo using gallery and edit the photo with specific photos in app.i just need some advise. i can open a photo from user gallery and i can save a photo,but my problem is that i don't know how to edit the photo that i open with my the photos in app and save as a one picture. this code open an image:
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent, <unique_code>);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && resultCode == <unique_code>) {
imageView.setImageBitmap(getPicture(data.getData()));
}
}
public static Bitmap getPicture(Uri selectedImage) {
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContext().getContentResolver().query(selectedImage, filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
return BitmapFactory.decodeFile(picturePath);
}
0 comments:
Post a Comment