Created
April 16, 2016 20:25
-
-
Save ryanlntn/7d92da947250955cedfa53096b007091 to your computer and use it in GitHub Desktop.
ImagePickerModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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