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 8817285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:48:34+00:00 2026-06-14T04:48:34+00:00

I’m currently having a standard image selection (from the SD card) dialog shown when

  • 0

I’m currently having a standard image selection (from the SD card) dialog shown when firing off this intent:

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE);

This lists all the applications/activities that can return an image (such as Gallery).

In this same standard list, I also want to include an option that will start the Camera and return an image taken with it. The problem is I can’t figure out how to do this in a non-custom way (building my own dialog with a custom layout, application image + title etc).

The Camera activity can be launched like this:

Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
URI pictureUri = Uri.fromFile(new File("dummyPath"));
camera.putExtra(MediaStore.EXTRA_OUTPUT, pictureUri);

Is there an intent that will allow me to select an image from the SD card or one taken with the Camera?

Update: I have found a solution, will double check and post it here afterwards.

  • 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-06-14T04:48:35+00:00Added an answer on June 14, 2026 at 4:48 am

    you can have alert dialog to show options.
    Source code is given below:

    AlertDialog.Builder getImageFrom = new AlertDialog.Builder(MainActivity.this);
                getImageFrom.setTitle("Select Image");
                final CharSequence[] opsChars = {"Take Picture", "Open Gallery"};
                getImageFrom.setItems(opsChars, new android.content.DialogInterface.OnClickListener(){
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        if(which == 0){
                             File file = new File( _path );
                             outputFileUri = Uri.fromFile( file );
    
                            Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
                            cameraIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);   
    
                            startActivityForResult(cameraIntent, 7);
                        }else
                            if(which == 1){
                                Intent intent = new Intent();
                                intent.setType("image/*");
                                intent.setAction(Intent.ACTION_GET_CONTENT);
                                startActivityForResult(Intent.createChooser(intent,
                                    "Open Gallery"), 6);
                            }
                        dialog.dismiss();
                    }
                });
    
    
        public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == RESULT_OK) {
            if (requestCode == 6) {
                Uri selectedImageUri = data.getData();
             pickerImageView.setPadding(0, 0, 0, 0);
             pickerImageView.setScaleType(ScaleType.FIT_XY);
             System.gc();
               String filepath = getPath(selectedImageUri);
               File imagefile = new File(filepath);
               try {
                FileInputStream fis = new FileInputStream(imagefile);
                BitmapFactory.Options options=new BitmapFactory.Options();
                options.inPurgeable=true;
                options.inSampleSize =4;
                bi= BitmapFactory.decodeStream(fis,null,options);
                fis.close();
                Bitmap bitmapToRecycle = ((BitmapDrawable)pickerImageView.getDrawable()).getBitmap();  
                bitmapToRecycle.recycle();
                pickerImageView.setImageBitmap(bi); 
                pickerImageView.setPadding(0, 0, 0, 0);
                pickerImageView.setScaleType(ScaleType.FIT_XY);
    
    
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
               pickImageTextView.setText("");
            }
            else if(requestCode == 7){
                Log.i("return", "#####");
                BitmapFactory.Options options=new BitmapFactory.Options();
                options.inPurgeable=true;
                options.inSampleSize =4;
                //Bitmap photo = BitmapFactory.decodeFile( _path, options );
                 Bitmap photo = (Bitmap) data.getExtras().get("data"); 
                 pickerImageView.setImageBitmap(photo); 
                 pickerImageView.setPadding(0, 0, 0, 0);
                 pickerImageView.setScaleType(ScaleType.FIT_XY);
    
            } 
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
We're building an app, our first using Rails 3, and we're having to build

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.