Created
April 19, 2015 12:03
-
-
Save defHLT/b356474e3eb2624a08d5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public void invokePicker(Integer requestCode) { | |
Intent intentGetContent = new Intent(Intent.ACTION_GET_CONTENT, | |
MediaStore.Images.Media.INTERNAL_CONTENT_URI); | |
intentGetContent.setType("image/*"); | |
final PackageManager pm = getPackageManager(); | |
final Intent i = new Intent(intentGetContent); | |
final List list = pm.queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY); | |
if (list.size() > 0) { | |
startActivityForResult(intentGetContent, requestCode); | |
} else { | |
Intent intentPick = new Intent(Intent.ACTION_PICK, | |
MediaStore.Images.Media.INTERNAL_CONTENT_URI); | |
intentPick.setType("image/*"); | |
startActivityForResult(Intent.createChooser(intentPick, "Complete action using"), | |
requestCode); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment