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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:39:20+00:00 2026-06-06T09:39:20+00:00

I’m writing an application which have to take a picture and send it to

  • 0

I’m writing an application which have to take a picture and send it to a web service.
There is the code I use to :

i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
outputFileUri = Uri.fromFile(new File(Environment.getExternalStorageDirectory()+"/appicture.jpg"));
Log.i("URI", outputFileUri.toString());
i.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(i, cameraData);

The URI looks like :

file:///sdcard/appicture.jpg

But if I put “outputFileUri” var in the i.putExtra, my app just quit.
If not, I can take the picture but I can’t get her URI then unable to send it to my webservice.

EDIT 1 :
Error log ( on the activity resylt)

06-26 09:17:46.108: I/Cam error(699): java.lang.NullPointerException

EDIT 2 :
If I remove the “outputFileUri”, I correctly got the Image. But, then I’m unable to convert the Bitmap into File to be able to send it.

if(resultCode == RESULT_OK){

            Bundle extras = data.getExtras();
            _bmp = (Bitmap) extras.get("data"); 

        }

EDIT 3 :

The problem was from

_bmp = (Bitmap) extras.get(“data”);

And the picture is correctly save in the sd card.

  • 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-06T09:39:23+00:00Added an answer on June 6, 2026 at 9:39 am

    Add WRITE_EXTERNAL_STORAGE permission in Manifest:

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    

    EDIT:
    if you are passing Image Uri in Intent for Capturing image then get image as in onActiityResult as:

    @Override  
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {    
            if (requestCode == cameraData) {  
                File picture = new File(Environment.getExternalStorageDirectory() + "/appicture.jpg"); 
                Uri imguri=Uri.fromFile(picture);
                }
            super.onActivityResult(requestCode, resultCode, data);  
        }  
    

    and if you want to get image as data in onActiityResult then Launch Camra as:

    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);  
    startActivityForResult(intent, cameraData);  
    

    in onActivityResult:

     onActivityResult(int requestCode, int resultCode, Intent data) {  
            if (requestCode == 1) {  
                if (resultCode == cameraData) {  
                    Bundle extras = data.getExtras();
                    _bmp = (Bitmap) extras.get("data"); //Get data here
    
                }  
            }  
    }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have an autohotkey script which looks up a word in a bilingual dictionary
I have a text area in my form which accepts all possible characters from
I have an array which has BIG numbers and small numbers in it. I
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.