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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:32:24+00:00 2026-06-08T07:32:24+00:00

i m using a custom dialog with an ImageView and 2 Button . first

  • 0

i m using a custom dialog with an ImageView and 2 Button.

  1. first button to pick image from gallery
  2. second button to click image from camera

i want to show the image in the ImageView of the dialog..

btn1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
        Dialog();   
        }

        private void Dialog() {
            // TODO Auto-generated method stub
            final Dialog dialog=new Dialog(editevent1.this);
            dialog.setContentView(R.layout.promote2);
            ImageView image =(ImageView)findViewById(R.id.image_camera);
            Button d=(Button)dialog.findViewById(R.id.button2);
            Button f=(Button)dialog.findViewById(R.id.button3);

            dialog.show();
            d.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    Intent intent = new Intent(Intent.ACTION_PICK);
                    intent.setType("image/*");
                    startActivityForResult(intent, 1);


                }
            });
            f.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    Intent cameraintent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);

                    startActivityForResult(cameraintent, CAMERA_PIC_REQUEST);
                }
            });


            }


});



@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) 
{
    super.onActivityResult(requestCode, resultCode, data);
    if( requestCode == CAMERA_PIC_REQUEST)
    {   
        Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
        ImageView image =(ImageView)findViewById(R.id.image_camera);
        image.setImageBitmap(thumbnail);
    }
    else 
    {
        Toast.makeText(this, "Picture NOt taken", Toast.LENGTH_LONG);            
    }

}

please tell me how do i get the image in ImageView which is in DialogBox for both when picked from gallery and when clicked from camera. thanks

  • 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-08T07:32:25+00:00Added an answer on June 8, 2026 at 7:32 am

    I am not sure this can be done using a Dialog but instead of a custom dialog, try and use an Activity that has the UI of a dialog. To use an Activity as a dialog you need to define this in the AndroidManifest.xml:

    <activity android:theme="@android:style/Theme.Dialog" />

    EDIT for Comment

    1. If you used my suggestion (an Activity with the UI of a Dialog let’s name it DialogActivity for our purposes), you do not have to do that since you can override the onActivityResult method in your DialogActivity.
    2. If you have not used my suggestion or have used it but need to pass the taken image to another Activity either way. To pass an image that was taken by the camera app from one Activity to another, i believe the most efficient way is to pass in the Intent as a String the path of that image and access the path on the second Activity. Something like this:

    In the first Activity (the caller Activity), let’s call it A:

    Intent i = new Intent(A.this, B.class);
    i.putExtra("path", path); //The path is a String variable holding the path where the image was saved.
    startActivity(i);
    

    In the second Activity (the Activity being called), let’s call it B:

    String image_path = getIntent().getExtras().getString("path");
    Bitmap bitmap = BitmapFactory.decodeFile(image_path);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a custom Alert dialog. If user go with negative button of
I am trying to show a progress dialog from a custom dialog while an
I want to have a custom dialog (created using layout) in Preferences . What
I'm using a CMFCLinkCtrl in my custom dialog that inherits from CDialog. The CMFCLinkCtrl
I'm trying to pop up a custom dialog when I click on a button
In my android application, I am using a custom dialog. When I try to
I am using PopupManager in FB4 to display a custom dialog. popwin = new
I have an activity that appears as a dialog using the following custom theme:
i am using custom checkbox buttons in my table view and want to save
I'm using custom class that subclass from UILabel. It works fine unless I change

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.