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

  • SEARCH
  • Home
  • 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 6658443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:54:53+00:00 2026-05-26T01:54:53+00:00

Hi I have this button and when I click on it I’d like to

  • 0

Hi I have this button and when I click on it I’d like to launch a Complete Action Using window that would allow me to choose between Camera & Gallery.

Is there an easier way to implement this other than creating a dialog.

  • 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-26T01:54:53+00:00Added an answer on May 26, 2026 at 1:54 am
       AlertDialog.Builder builder = new AlertDialog.Builder(this);
                builder.setMessage(
                        context.getString(R.string.Select_an_Option_to_add_Photo))
                        .setCancelable(true)
                        .setPositiveButton(context.getString(R.string.Camera),
                                new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog, int id) {
                                        try {
                                            Intent action = new Intent(
                                                    "android.media.action.IMAGE_CAPTURE");
                                            action.putExtra(
                                                    MediaStore.EXTRA_OUTPUT,
                                                    MediaStore.Images.Media.EXTERNAL_CONTENT_URI
                                                            .toString());
                                            startActivityForResult(action, 8);
                                        } catch (Exception e) {
                                            // TODO Auto-generated catch block
                                            e.printStackTrace();
                                        }
                                    }
    
                                })
                        .setNegativeButton(context.getString(R.string.Gallery),
                                new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog, int id) {
                                        dialog.cancel();
    
                                        try {
                                            Intent photoPickerIntent = new Intent(
                                                    Intent.ACTION_GET_CONTENT);
                                            photoPickerIntent.setType("image/*");
                                            startActivityForResult(photoPickerIntent, 1);
                                        } catch (Exception e) {
                                            // TODO Auto-generated catch block
                                            e.printStackTrace();
                                        }
                                    }
                                });
                alert = builder.create();
    

    Now

    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    
            super.onActivityResult(requestCode, resultCode, data);
    
            if (resultCode == RESULT_OK && requestCode == 8) {
    
                Bitmap photoBitMap = (Bitmap) data.getExtras().get("data");
    
                Bitmap usableBMP = Bitmap.createScaledBitmap(photoBitMap, 68, 80,
                        true);
    //This is my ImageView Object           
    cameraButton.setImageBitmap(usableBMP);
                cameraButton.setScaleType(ScaleType.CENTER_INSIDE);
            } else if (resultCode == RESULT_OK) {
                Uri chosenImageUri = data.getData();
                try {
    //Here I scale my Bitmap as desired
                    photoBitMap = Media.getBitmap(this.getContentResolver(),
                            chosenImageUri);
                    Bitmap usableBMP = Bitmap.createScaledBitmap(photoBitMap, 68,
                            80, true);
    
    //this is my ImageView Object
                    cameraButton.setImageBitmap(usableBMP);
                    cameraButton.setScaleType(ScaleType.CENTER_INSIDE);
                } catch (FileNotFoundException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code that has one button that let's me choose an entry
So I have this code that should listen for a click on #button but
I have this code in the end of link button click: Response.ContentType = application/zip;
I have an NIB file with a button. When I click this button, the
I have jQuery code which looks something like this on Button1 Click $('table.result_grid tbody
I have this button on the leftside of my UISplitViewController (RootViewController) that has a
I have this setup: <div class=fadetoggle> <div>Content</div> <div>Content</div> </div> And this code: $(.button).click(function ()
I have this code in a button click for ratting this app -(IBAction)_clickbtnratethisApp:(id)sender {
I disable my jqueryui button in its click event like this $('#btn').button().click(function(){ $(this).button('disable'); });
I have this jquery button click function: $(#NextButton_ButtonCtrl).live(click, function (event) { var i =

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.