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

The Archive Base Latest Questions

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

frnds,on clicking on button i open camera for taking picture ,i take picture successfull

  • 0

frnds,on clicking on button i open camera for taking picture ,i take picture successfull and now only two option is coming after clicking pic,”save” and “Discard”,there is not any option for attaching the camera clicked image so how to attach image and display image in next view?

my code is …

       public void function2(int id){



               Intent cameraIntent = new   Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);

                              startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);

        }


         public void onActivityResult(int requestCode, int resultCode, Intent data) {

             if (requestCode == CAMERA_PIC_REQUEST||requestCode == SELECT_PICTURE) {
                try{
                    try{
                      selectedImageUri = data.getData();

                    //OI FILE Manager
                   String  filemanagerstring = selectedImageUri.getPath();

                    //MEDIA GALLERY
                   selectedImagePath = getPath(selectedImageUri);

                    //DEBUG PURPOSE - you can delete this if you want
                    if(selectedImagePath!=null){

                         Intent i=new Intent(MainMenu.this,Imageprview.class);
                          startActivity(i);
                          System.out.println(selectedImagePath);
                    }

                    else
                        System.out.println("selectedImagePath is null");
                    if(filemanagerstring!=null)
                        System.out.println(filemanagerstring);
                    else System.out.println("filemanagerstring is null");

                    //NOW WE HAVE OUR WANTED STRING
                    if(selectedImagePath!=null)
                        System.out.println("selectedImagePath is the right one for you!");
                    else
                        System.out.println("filemanagerstring is the right one for you!");
                }catch (NullPointerException e) {
                    // TODO: handle exception
                }          }catch (ArrayIndexOutOfBoundsException e) {
                    // TODO: handle exception
                }     }
        }

        //UPDATED!
        public String getPath(Uri uri) {
            String[] projection = {MediaStore.Images.Media.DATA };
            Cursor cursor = managedQuery(uri, projection, null, null, null);
            if(cursor!=null)
            {
                //HERE YOU WILL GET A NULLPOINTER IF CURSOR IS NULL
                //THIS CAN BE, IF YOU USED OI FILE MANAGER FOR PICKING THE MEDIA
                int column_index = cursor
                .getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
                cursor.moveToFirst();
                return cursor.getString(column_index);
            }
            else return null;
        }
  • 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-26T00:58:54+00:00Added an answer on May 26, 2026 at 12:58 am

    There is no such option available.you can save file in to sdcard or any external storage
    c the code i have done for saving image in external storage.

    public void onClick(View v)
    {
    if(v == imgForPhotograph) {
    
                path = Environment.getExternalStorageDirectory() + "/photo1.jpg";
    
                File file = new File(path);
                Uri outputFileUri = Uri.fromFile(file);
                Intent intent = new Intent(
                        android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
                intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
                startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY);
            }
    }
    
    
        public void onActivityResult(int requestCode, int resultCode, Intent data) {
                System.gc();
                if (requestCode == CAPTURE_IMAGE_ACTIVITY) {
                    if (resultCode == Activity.RESULT_OK) {
                        try {
                            // Call function MakeFolder to create folder structure if
                            // its not created
                            if(imageBitmap != null) {
                                imageBitmap = null;
                                imageBitmap.recycle();
                            }
    
                            BitmapFactory.Options options = new BitmapFactory.Options();
                            options.inSampleSize = 3;
                            imageBitmap = BitmapFactory.decodeFile(path, options);
    
    
                            ByteArrayOutputStream baos = new ByteArrayOutputStream();
                            imageBitmap.compress(Bitmap.CompressFormat.PNG, 100, baos); // bm
    
                               byte[] bmpbyte = baos.toByteArray();
                               //
                            Imagebase64= Base64.encodeToString(bmpbyte, Base64.DEFAULT); // set
    
    
                            imgForPhotograph.setImageBitmap(imageBitmap);
                            isImageTaken = true;
                            // Name for image
                            IMAGEPATH = getString(R.string.Image)
                                    + System.currentTimeMillis();
                            SaveImageFile(imageBitmap,IMAGEPATH);
                        } catch (Exception e) {
                            Toast.makeText(this, "Picture Not taken",
                                            Toast.LENGTH_LONG).show();
                            e.printStackTrace();
                        }
                    }
                }
    

    }

    All The Best….

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

Sidebar

Related Questions

Hie frnds, I have two tables say Orders and OrdersXML now I wish to
On Paypal Sandbox: After logging in using a test account and then clicking the
hi frnds i have a button and a textview in a whole view,when i
After destroying a resource in my Rails application, the user can restore it clicking
Hello frnds I have windows mobile application, that retrieves location info. Now i want
Hello frnds actually i have a array of arrays as given below:-` parrent array{
Assuming two database tables: Funds and Prices , in which Funds hasMany Prices .
I'm trying to implement a button to update a single attribute (setting an Active
at this page new customer , there is some clash between the two scripts.
well frnds my code for maps works well and shows all pics and gradient

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.