private static final int REQUEST_PICK_IMAGE = 1;
protected void ... {
...
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, REQUEST_PICK_IMAGE);
...
}
@Overrideprotected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
switch (requestCode) {
case REQUEST_PICK_IMAGE:
if (resultCode == RESULT_OK) {
//handle image
//data.getData
} else {
finish();
}
break;
default:
super.onActivityResult(requestCode, resultCode, data);
break;
}
}
댓글
댓글 쓰기