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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:10:57+00:00 2026-06-04T11:10:57+00:00

This app for testing use Builtin camera in android ??? what is the error

  • 0

This app for testing use Builtin camera in android ???
what is the error in my code which cause this error

i am starting camera and capture a photo then i want to display it in imageView

i found that the photo stored in SDcard but cannot use it in onActivityResult method

package com.world.hello;

import java.io.File;

import android.app.Activity;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;

public class Main extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button btn = (Button) findViewById(R.id.button1);
        btn.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(
                        "/sdcard/Pictures/MyCameraApp/IMAG.jpg")));
                startActivityForResult(intent, 100);
            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == RESULT_OK) {
            if (requestCode == 100) {
                Log.d("Image", data.getData().toString());
//              ImageView iv = (ImageView) findViewById(R.id.imageView1);
//              iv.setImageBitmap(BitmapFactory.decodeFile(data.getData().toString()));
            }
        }
    }
}

Why this error ??

05-24 17:19:40.164: E/AndroidRuntime(4759): FATAL EXCEPTION: main
05-24 17:19:40.164: E/AndroidRuntime(4759): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=100, result=-1, data=null} to activity {com.world.hello/com.world.hello.Main}: java.lang.NullPointerException
05-24 17:19:40.164: E/AndroidRuntime(4759):     at android.app.ActivityThread.deliverResults(ActivityThread.java:2980)
05-24 17:19:40.164: E/AndroidRuntime(4759):     at android.app.ActivityThread.handleSendResult(ActivityThread.java:3023)
05-24 17:19:40.164: E/AndroidRuntime(4759):     at android.app.ActivityThread.access$1100(ActivityThread.java:123)
05-24 17:19:40.164: E/AndroidRuntime(4759):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1177)
05-24 17:19:40.164: E/AndroidRuntime(4759):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-24 17:19:40.164: E/AndroidRuntime(4759):     at android.os.Looper.loop(Looper.java:137)
05-24 17:19:40.164: E/AndroidRuntime(4759):     at android.app.ActivityThread.main(ActivityThread.java:4424)
05-24 17:19:40.164: E/AndroidRuntime(4759):     at java.lang.reflect.Method.invokeNative(Native Method)
05-24 17:19:40.164: E/AndroidRuntime(4759):     at java.lang.reflect.Method.invoke(Method.java:511)
05-24 17:19:40.164: E/AndroidRuntime(4759):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-24 17:19:40.164: E/AndroidRuntime(4759):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-24 17:19:40.164: E/AndroidRuntime(4759):     at dalvik.system.NativeStart.main(Native Method)
05-24 17:19:40.164: E/AndroidRuntime(4759): Caused by: java.lang.NullPointerException
05-24 17:19:40.164: E/AndroidRuntime(4759):     at com.world.hello.Main.onActivityResult(Main.java:40)
05-24 17:19:40.164: E/AndroidRuntime(4759):     at android.app.Activity.dispatchActivityResult(Activity.java:4649)
05-24 17:19:40.164: E/AndroidRuntime(4759):     at android.app.ActivityThread.deliverResults(ActivityThread.java:2976)
05-24 17:19:40.164: E/AndroidRuntime(4759):     ... 11 more
  • 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-04T11:10:59+00:00Added an answer on June 4, 2026 at 11:10 am
     Log.d("Image", data.getData().toString());
    

    You don’t need to get the data then. You already know the location of the file that the image is saved to. Use that directly.

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

Sidebar

Related Questions

I'm testing my app on a jailbroken iPhone. In my code I use [NSUserDefaults
Possible Duplicate: Testing use of NSURLConnection with HTTP response error statuses This is bizarre;
I'm testing my app using HTC Wildfire with Android 2.2.1. The default camera preview
I'm using this django app to implement PayPal IPN. I'm testing it using PayPal's
I ran into this issue while testing a rails app deployed to two different
So I have this app which needs to query entities from the Azure Tables
I have this app (contacts style) in which you can add instances to a
I have been developing an Android app and testing with a 1.5 AVD and
I need to quickly write a test console app for testing purposes. This app
we have an app which is available for ipad, iphone, android as well as

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.