Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6003931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:11:28+00:00 2026-05-23T01:11:28+00:00

I am trying to allow a user to select an image, either from the

  • 0

I am trying to allow a user to select an image, either from the gallery or by taking a picture with the camera. I tried this:

        Intent imageIntent = new Intent(Intent.ACTION_GET_CONTENT);
        imageIntent.setType("image/*");
        startActivityForResult(Intent.createChooser(imageIntent, "Select Picture"), GET_IMAGE_REQUEST);

but it automatically displays the gallery without even providing an option to choose an activity. It seems like there should be some better way to accomplish this than the solution given in this question. Is that really the only way do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:11:29+00:00Added an answer on May 23, 2026 at 1:11 am

    You should do this logic within your app. Picking image from gallery and taking picture using camera are using different intent.

    I suggest you use button (or whatever UI it is to make a user select an action) and creates two separate method for both actions. Let’s say, you’ve created two buttons named btnPickGallery and btnTakePicture.

    Both buttons fire their own action, say onBtnPickGallery and onBtnTakePicture.

    public void onBtnPickGallery() {
        Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(Intent.createChooser(intent, "Select Picture"), GALLERY_REQUEST_CODE);
    }
    
    public void onBtnTakePicture() {
        Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        File photo = new File(Environment.getExternalStorageDirectory(), "dir/pic.jpg");
    
        Uri outputFileUri = Uri.fromFile(photo);
    
        cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
        startActivityForResult(cameraIntent, CAMERA_REQUEST_CODE);
    }
    

    And then you can grab the result using onActivityResult() method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

friends, i am trying to display image from gallery now i want to put
Im trying to build a page that will allow a user to select a
I'm trying to configure Apache to allow read only access and ask for user
So I'm trying to allow the user to pick a particular piece of media
We are currently planning on trying to allow a user to be able to
I am using wordpress as a CMS and trying to allow user fields to
I'm working with sqlite and trying to create a table from another. This works:
In my iPad application, I'm letting the user select an image using the following
I'm trying to create a user control that allows users to make something like
I'm working on a forums system. I'm trying to allow users to see the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.