You have to specify an action for invoking a chooser/app via an intent. And since the action for selecting an image from gallery and taking a new image using the camera, are different, i don't think a chooser will have both option for uploading an image and taking a new image at the same time. For reference you could check profile picture changing procedure in facebook or whatsaapp. When clicking on the image to change, a custom dialog is shown with the option to either upload an image, take a new image, or select from a previously uploaded image. Based on what the user selects the app navigates the user to the particular app(camera/gallery etc)
What you can do is first create a custom dialog(or a layout based on your application's design) with two options
- Take a new image.
- Upload an Image from gallery.
Based on what the user clicks execute the code to navigate the user to, either the gallery or the camera application. If the user clicks on Upload an image from gallery, execute your above code and if the user clicks on Take a new image, then execute the code for opening the camera.
private void takeNewImage() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(takePictureIntent,CAMERA_INTENT_REQ_CODE);
}