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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:30:13+00:00 2026-06-13T02:30:13+00:00

I am capturing images using MediaStore.ACTION_IMAGE_CAPTURE intent. it is working fine in most of

  • 0

I am capturing images using MediaStore.ACTION_IMAGE_CAPTURE intent. it is working fine in most of the devices. but it is not working correctly in some latest android device as expected.

my intention is capture image using camera and send it to the server but not to store that image in default gallery of the device.

**: When i capture image, it is returning some other gallery image in onActivityResult method instead of captured image in some latest android devices.
I am using below code to capture and store images.

public void launchCamera(View v) {
    Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    startActivityForResult(camera, CAMERA_PIC_REQUEST );
}

In onActivityResult method,

String[] projection = { MediaStore.Images.ImageColumns.SIZE,
                    MediaStore.Images.ImageColumns.DISPLAY_NAME,
                    MediaStore.Images.ImageColumns.DATA, BaseColumns._ID, };
            Cursor c = null;
            Uri u = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
            try {
                if (u != null) {
                    c = managedQuery(u, projection, null, null, null);
                }
                if ((c != null) && (c.moveToLast())) {
                    Bitmap thumbnail = getBitMapFromLocalPath(c.getString(2), 3);
                    idsImagesgot.add(thumbnail);
                    ContentResolver cr = getContentResolver();
                    cr.delete( MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
                            BaseColumns._ID + "=" + c.getString(3), null);
                }
            } finally {
                if (c != null) {
                    c.close();
                }
            }

Can any one help me out in this regards.

Thanks in advance.

Sathish

  • 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-13T02:30:15+00:00Added an answer on June 13, 2026 at 2:30 am

    Photos taken by the ACTION_IMAGE_CAPTURE are not registered in the MediaStore automatically on all devices.

    The official Android guide gives that example:
    http://developer.android.com/guide/topics/media/camera.html#intent-receive
    But that does not work either on all devices.

    The only reliable method I am aware of consists in saving the path to the picture in a local variable. Beware that your app may get killed while in background (while the camera app is running), so you must save the path during onSaveInstanceState.

    Edit after comment:

    Create a temporary file name where the photo will be stored when starting the intent.

    File tempFile = File.createTempFile("my_app", ".jpg");
    fileName = tempFile.getAbsolutePath();
    Uri uri = Uri.fromFile(tempFile);
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
    startActivityForResult(intent, PICTURE_REQUEST_CODE);
    

    fileName is a String, a field of your activity. You must save it that way:

    @Override
    public void onSaveInstanceState(Bundle bundle)
    {
     super.onSaveInstanceState(bundle);
     bundle.putString("fileName", fileName);
    }
    

    and recover it in onCreate():

    public void onCreate(Bundle savedInstanceState)
    {
     if (savedInstanceState != null)
      fileName = savedInstanceState.getString("fileName");
     // ...
    }
    

    Now, at the time of onActivityResult, you know the name of the file where the photo was stored (fileName). You can do anything you wish with it, and then delete it.

    2013-09-19 edit: It seems that some camera apps ignore the putExtra uri, and store the pic in a different place. So, before using the value of fileName you should check whether the intent is null or not. If you get a non-null intent, then you should prefer intent.getData() over fileName. Use fileName as a backup solution only when it is needed.

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

Sidebar

Related Questions

I'm working with AVCaptureSession for capturing the image. Its working fine but not giving
I am working on an App and capturing images using UIImagePickerController . When application
Hi I am using ACTION_IMAGE_CAPTURE for capturing image using Intent as follows: Intent cameraIntent
I am using GLUT for my windowing system to output some images onto the
I'm capturing images using this code #pragma mark - image capture // Create and
I am using the AV Foundation for capturing images continuously after Apple released iOS
I'm using this tutorial for capturing images with AVFoundation. I'm trying to get the
I am using silverlight plugin for capturing images through webcam and want to save
Hi I am developing a app that captures images and email it capturing the
I am capturing some events in a C# program that come back with 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.