Skip to content

Instantly share code, notes, and snippets.

@ryanlntn
Created April 16, 2016 20:25
Show Gist options
  • Save ryanlntn/7d92da947250955cedfa53096b007091 to your computer and use it in GitHub Desktop.
Save ryanlntn/7d92da947250955cedfa53096b007091 to your computer and use it in GitHub Desktop.
ImagePickerModule.java
@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
if (pickerSuccessCallback != null) {
if (resultCode == Activity.RESULT_CANCELED) {
pickerCancelCallback.invoke("ImagePicker was cancelled");
} else if (resultCode == Activity.RESULT_OK) {
Uri uri = intent.getData();
if (uri == null) {
pickerCancelCallback.invoke("No image data found");
} else {
try {
pickerSuccessCallback.invoke(uri);
} catch (Exception e) {
pickerCancelCallback.invoke("No image data found");
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment