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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:48:40+00:00 2026-05-15T21:48:40+00:00

I have a fairly simple app that launches the camera from a menu. The

  • 0

I have a fairly simple app that launches the camera from a menu. The camera launches fine, but when I hit ok after taking a picture I get a NPE on my nexus one:

E/AndroidRuntime( 3891): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=null} to activity {net.asplode.tr/net.asplode.tr.PostImage}: java.lang.NullPointerException
E/AndroidRuntime( 3891):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3515)
E/AndroidRuntime( 3891):    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3557)
E/AndroidRuntime( 3891):    at android.app.ActivityThread.access$2800(ActivityThread.java:125)
E/AndroidRuntime( 3891):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2063)
E/AndroidRuntime( 3891):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 3891):    at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 3891):    at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 3891):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3891):    at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 3891):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 3891):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 3891):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 3891): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 3891):    at net.asplode.tr.PostImage.onActivityResult(PostImage.java:92)
E/AndroidRuntime( 3891):    at android.app.Activity.dispatchActivityResult(Activity.java:3890)
E/AndroidRuntime( 3891):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3511)
E/AndroidRuntime( 3891):    ... 11 more
W/ActivityManager(   85):   Force finishing activity net.asplode.tr/.PostImage

Code:

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.mnuCamera) {
        Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        ContentValues values = new ContentValues();
        values.put(Media.TITLE, "image");
        Uri tempPhotoUri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values);
        cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, tempPhotoUri);
        startActivityForResult(cameraIntent, FROM_CAMERA);
        return true;
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != RESULT_OK) {
        return;
    }
    Uri imageUri = data.getData();
    Log.i("imageUri: ", imageUri.toString());
}
  • 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-15T21:48:40+00:00Added an answer on May 15, 2026 at 9:48 pm

    Turns out the stock camera application doesn’t send EXTRA_OUTPUT, which is why it’s null. However, some camera apps (like the hero) do. Awesome.
    So the answer is to specify EXTRA_OUTPUT. The nexus one camera app will save the image to that location. Then in onActivityResult() check if the intent is null. If it isn’t, use data.getData(), and if it is then use the location specific in EXTRA_OUTPUT via a constant and insert it into the Mediastore. Urgh.

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

Sidebar

Related Questions

Let's say I have a fairly simple app that lets users store information on
I have a fairly simple web app that uses cookies to store some information
I have a fairly simple iPhone app that downloads a set of UITableView results
I've got a fairly simple NodeJS app that is nothing but a shell that
I have a fairly simple ASP.NET 2.0 menu control using a sitemap file and
I have a fairly simple const struct in some C code that simply holds
I have the following (fairly) simple JavaScript snippet that I have wired into Greasemonkey.
I have a fairly simple iPhone application that I want to have run on
I am trying to build an fairly simple iPad app that requires me to
I have a fairly simple view hierarchy in my iPad app. Window -> RootView

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.