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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:10:27+00:00 2026-05-27T13:10:27+00:00

I am using the default camera intent to get the image in my app.

  • 0

I am using the default camera intent to get the image in my app. The problem is camera returns null on onActivityResult() . The ResultCode and RequestCode are returning as expected.

My intent call is:

private static final int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 1224;
....
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);

OnactivityResult is:

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
    //use imageUri here to access the image
    Uri imageuri = data.getData(); // here is getting crash 
    imageView.setImageFromUri(imageUri);
}
}
}

void setImageFromUri(Uri imgUri){
 ... TODO assign image from uri
}

As I put Log I got the resultCode and responseCode are not null

resultCode = -1
requestCode = 1224

Where I am doing mistake?

But the taken picture is stored in the path (imageUri) as I specified

Is there any other way to get image using camera.

  • 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-27T13:10:28+00:00Added an answer on May 27, 2026 at 1:10 pm

    Seems you know the imageUri before onActivityResult. This is not correct answer but will work fine.

    intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); 
    

    // This image uri only you’re going to use

    So don’t use

     Uri imageuri = data.getData();
    

    just use the uri you known.

    your code looks like this:

    if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {
      if (resultCode == RESULT_OK) {
    //use imageUri here to access the image
    imageView.setImageFromUri(imageUri); // imageUri should be global in the activity
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the problem. I am using AVCaptureVideoDataOutput to get video frames from camera and
I am using the following code to start the default Camera.Image is getting saved
Photographs and videos using the default camera app are saved on the SD card.
I'm testing my app using HTC Wildfire with Android 2.2.1. The default camera preview
Well, in my application I'm using default camera and gallery of Android with startActivityforResult
I am using AVFoundation classes to implement a custom camera in my app. I
What's the best way to get a reference to other views using default controllers?
in my app i want use the camera for capturing image and send to
I'm using Paperclip to handle avatar's for users and currently set a default image
In my application, Im using the default blackberry camera player to capture images using

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.