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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:46:11+00:00 2026-06-12T16:46:11+00:00

I am trying to capture an image from an existing camera application, save the

  • 0

I am trying to capture an image from an existing camera application, save the image in a customized folder, and display the thumbnail in and imageView. The camera supplies the thumbnail as long as I haven’t specified where to save the file:

I can get the thumbnail from the returned intent:

...
  Intent i = = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  startActivityForResult(i)
}

protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
  super.onActivityResult(requestCode, resultCode, intent);      
  Bundle extras = intent.getExtras();
  Bitmap mImageBitmap = (Bitmap) extras.get("data");
}

Or I can save the file in a specified folder (which works fine)

  ...
  Intent i = = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  i.putExtra((MediaStore.EXTRA_OUTPUT, outputFileUri);
  startActivityForResult(i)
}

but the thumbnail is no longer stored in the intent extra “data”, and when I try to retrieve the thumbnail, I get an error (this is from my LogCat)

10-04 06:30:14.463: E/AndroidRuntime(1967): Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=null} to activity: java.lang.NullPointerException

As you can see, the field returned is null instead of the bitmap thumbnail. I have tried decoding the bitmap afterwards to generate a thumbnail from the file directly, but it takes too long (even when downsampled I get out of memory error) , and it seems counterintuitive to do the job twice. Any suggestions?

  • 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-12T16:46:13+00:00Added an answer on June 12, 2026 at 4:46 pm

    Okay. If you are passing an outputURI to the intent then you will not be able to receive the data back from the intent in onActivityResult().

    I think only option is to use the same outputURI to display the thumbnail..

    Try this.

    void captureImage(){
        File file = new File(Environment.getExternalStorageDirectory()
        .getAbsolutePath() + "/MyFolder", "myImage"+ ".jpg");
    
        mCapturedImagePath = file.getAbsolutePath();
        Uri outputFileUri = Uri.fromFile(file);
        Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
        i.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
        startActivityForResult(i, CAMERA_REQUEST);
    }
    
    onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == CAMERA_REQUEST) {
            if (resultCode == RESULT_OK) {
                File file = new File(mCapturedImagePath);
                imageView.setImageURI(Uri.fromFile(file));
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am trying to open camera from my android application and capture image, but
I'm trying to capture an image from the camera preview and convert it to
I'm trying to load image (not URL) from either camera or gallery and save
I am trying to capture image and video from my android application with the
I'm trying to display video from a webcam. I capture the images from the
I am trying to capture video from a camera. i have gotten the captureOutput:didOutputSampleBuffer:
I'm developing an application that shall receive images from a camera device and display
I'm trying to capture an image from the window mobile device using Qt. Is
I am trying to implement an application which would take an image from the
I am trying to implement Camera application in android,and i got some code from

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.