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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:38:17+00:00 2026-05-23T14:38:17+00:00

i have problem using camera in my Android application i have a form for

  • 0

i have problem using camera in my Android application

i have a form for save data, there is a button to Take Picture with camera and the captured image from the camera will be placed on ImageView in my form.

there’s no problem on calling camera intent and placing the image in the form

my problem is :
in the camera application,
if i press back button (back to the form) my application crashed.

why?

this is the code on my button that call the camera

btn_takepic.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View arg0) {            
        Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
        startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
    }
});

this is my onActivityResult

    @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    final EditText et_foto = (EditText) findViewById(R.id.et_foto);
    if(requestCode == CAMERA_PIC_REQUEST) {          
            Bitmap thumbnail = (Bitmap) data.getExtras().get("data");  
        ImageView image = (ImageView) findViewById(R.id.imv_foto);  
        image.setImageBitmap(thumbnail);
        //toastkeun(data.getExtras().get("data").toString());
    }

    super.onActivityResult(requestCode, resultCode, data);
}

i’m testing on real device
this is my logCat

07-08 16:05:26.187: ERROR/AndroidRuntime(12116): FATAL EXCEPTION: main
07-08 16:05:26.187: ERROR/AndroidRuntime(12116): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2, result=0, data=null} to activity {com.ngimagrid.nigmago/com.ngimagrid.nigmago.FormAsetTambah}: java.lang.NullPointerException
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.app.ActivityThread.deliverResults(ActivityThread.java:3515)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.app.ActivityThread.handleSendResult(ActivityThread.java:3557)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.app.ActivityThread.access$2800(ActivityThread.java:125)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2063)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.os.Looper.loop(Looper.java:123)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.app.ActivityThread.main(ActivityThread.java:4627)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at java.lang.reflect.Method.invokeNative(Native Method)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at java.lang.reflect.Method.invoke(Method.java:521)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at dalvik.system.NativeStart.main(Native Method)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116): Caused by: java.lang.NullPointerException
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at com.ngimagrid.nigmago.FormAsetTambah.onActivityResult(FormAsetTambah.java:246)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.app.Activity.dispatchActivityResult(Activity.java:3890)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.app.ActivityThread.deliverResults(ActivityThread.java:3511)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     ... 11 more
07-08 16:05:26.187: ERROR/AndroidRuntime(12116): FATAL EXCEPTION: main
07-08 16:05:26.187: ERROR/AndroidRuntime(12116): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2, result=0, data=null} to activity {com.ngimagrid.nigmago/com.ngimagrid.nigmago.FormAsetTambah}: java.lang.NullPointerException
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.app.ActivityThread.deliverResults(ActivityThread.java:3515)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.app.ActivityThread.handleSendResult(ActivityThread.java:3557)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.app.ActivityThread.access$2800(ActivityThread.java:125)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2063)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.os.Looper.loop(Looper.java:123)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.app.ActivityThread.main(ActivityThread.java:4627)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at java.lang.reflect.Method.invokeNative(Native Method)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at java.lang.reflect.Method.invoke(Method.java:521)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at dalvik.system.NativeStart.main(Native Method)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116): Caused by: java.lang.NullPointerException
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at com.ngimagrid.nigmago.FormAsetTambah.onActivityResult(FormAsetTambah.java:246)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.app.Activity.dispatchActivityResult(Activity.java:3890)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     at android.app.ActivityThread.deliverResults(ActivityThread.java:3511)
07-08 16:05:26.187: ERROR/AndroidRuntime(12116):     ... 11 more

from this line, i think that’s the problem…

07-08 16:05:26.187: ERROR/AndroidRuntime(12116): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2, result=0, data=null} to activity {com.ngimagrid.nigmago/com.ngimagrid.nigmago.FormAsetTambah}: java.lang.NullPointerException

there’s no result returned right?
how to fix that?

thanks

cmiiw

  • 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-23T14:38:18+00:00Added an answer on May 23, 2026 at 2:38 pm

    I don’t think this is coming from your app. you can try to surround the whole onActivity result code in a try/catch block. i think what you are experiencing is a Camera bug on some of the phones. also try to try around different combinations of the extras you are sending on startActivityForResult intent.

    Also always check the result code before you do anything. you dont want to make the same code if the result is canceled(Activity.RESULT_CANCELED) or ok (Activity.RESULT_OK )

    also there is a bug where the result doesn’t come in the EXTRA_OUTPUT (i think it was named like that) but instead it comes as an Uri in intent.getData(). extra output is you providing a path where to save the file and the uri return is usually the image saved in the default camera location. its a bit different as you will see.

    You are not using flags atm but you should if you want the image location as a result. Search stack for some sample code for the extras.

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

Sidebar

Related Questions

I have an application which makes use of the default camera to take pictures
This is follow up to: Android local variable get's lost when using camera intent
I have a question this time around regarding the Android custom camera, NOT the
Recently I went thru the code for accessing the camera using flash ActionScript3 and
After introducing latest changes in Android SDK and Android Market it's now more or
I must be the first to face this problem because I can't find even
I have been researching for this and read different opinions but i wanted to
I am working on an Android app that I want to run on all
Possible Duplicate: How to edit image for e.g. permanently adding text on the image

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.