Skip to content

Instantly share code, notes, and snippets.

@gordinmitya
Created October 12, 2017 16:43
Show Gist options
  • Save gordinmitya/dce4a9bd0f3e2f0c1fbd5220df81c004 to your computer and use it in GitHub Desktop.
Save gordinmitya/dce4a9bd0f3e2f0c1fbd5220df81c004 to your computer and use it in GitHub Desktop.
Intent galleryIntent = new Intent(Intent.ACTION_GET_CONTENT,null);
galleryIntent.setType("image/*");
galleryIntent.addCategory(Intent.CATEGORY_OPENABLE);
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
Intent chooser = new Intent(Intent.ACTION_CHOOSER);
chooser.putExtra(Intent.EXTRA_INTENT, galleryIntent);
chooser.putExtra(Intent.EXTRA_TITLE, "title");
Intent[] intentArray = {cameraIntent};
chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);
startActivityForResult(chooser,REQUEST_CODE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment