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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:25:43+00:00 2026-06-02T14:25:43+00:00

This is my code: String _path = Environment.getExternalStorageDirectory() + File.separator + temp.jpg; File file

  • 0

This is my code:

 String _path = Environment.getExternalStorageDirectory() + File.separator +  "temp.jpg";
                           File file = new File( _path );
                           Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);             
                           Uri pictureUri = Uri.fromFile(file);
                           cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, pictureUri);
                           startActivityForResult(cameraIntent, CAMERA_REQUEST);

protected void onActivityResult(int requestCode, int resultCode, Intent data) {       
            switch(requestCode){
                case CAMERA_REQUEST:{
                    Bitmap bmp = (Bitmap) data.getExtras().get("data");    

and I have added in the manifest the:

<uses-permission android:name="android.permission.CAMERA" />
 <uses-feature android:name="android.hardware.camera" />
 <uses-feature android:name="android.hardware.camera.autofocus" />

What am I doing wrong? What i want at first is to save the image?

Logcat:

04-20 10:08:38.547: E/AndroidRuntime(219): Uncaught handler: thread main exiting due to uncaught exception
04-20 10:08:38.557: E/AndroidRuntime(219): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1888, result=-1, data=null} to activity {com.vimateam.android.bestgreekbeaches/com.vimateam.android.bestgreekbeaches.Gallery1}: java.lang.NullPointerException
04-20 10:08:38.557: E/AndroidRuntime(219):  at android.app.ActivityThread.deliverResults(ActivityThread.java:3329)
04-20 10:08:38.557: E/AndroidRuntime(219):  at android.app.ActivityThread.handleSendResult(ActivityThread.java:3371)
04-20 10:08:38.557: E/AndroidRuntime(219):  at android.app.ActivityThread.access$2700(ActivityThread.java:119)
04-20 10:08:38.557: E/AndroidRuntime(219):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1893)
04-20 10:08:38.557: E/AndroidRuntime(219):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-20 10:08:38.557: E/AndroidRuntime(219):  at android.os.Looper.loop(Looper.java:123)
04-20 10:08:38.557: E/AndroidRuntime(219):  at android.app.ActivityThread.main(ActivityThread.java:4363)
04-20 10:08:38.557: E/AndroidRuntime(219):  at java.lang.reflect.Method.invokeNative(Native Method)
04-20 10:08:38.557: E/AndroidRuntime(219):  at java.lang.reflect.Method.invoke(Method.java:521)
04-20 10:08:38.557: E/AndroidRuntime(219):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
04-20 10:08:38.557: E/AndroidRuntime(219):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
04-20 10:08:38.557: E/AndroidRuntime(219):  at dalvik.system.NativeStart.main(Native Method)
04-20 10:08:38.557: E/AndroidRuntime(219): Caused by: java.lang.NullPointerException
  • 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-02T14:25:45+00:00Added an answer on June 2, 2026 at 2:25 pm

    your are getting data part null bez you are not setting intent.setDataAndType() when you are starting Acitivty.if you want to take data as Bitmap then start camra activity as:

    public static final String IMAGE_UNSPECIFIED = "image/*"; 
        Intent intent = new Intent(Intent.ACTION_PICK, null);  
        intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, IMAGE_UNSPECIFIED);  
        startActivityForResult(intent, 3);  
    
        protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
        if (resultCode == 0)  
           return; 
        if (requestCode == 2) {  
           Uri uri=data.getData();  //YOU GET DATA HERE
            }  
    //OR
    if (requestCode == 3) {  
     Bundle extras = data.getExtras();  
     if (extras != null) {  
     Bitmap photo = extras.getParcelable("data");  
     ByteArrayOutputStream stream = new ByteArrayOutputStream();  
     photo.compress(Bitmap.CompressFormat.JPEG, 75, stream);// (0 - 100)????  
     imageView.setImageBitmap(photo);  
      }  
    }  
    

    or in your case getting image path use:

    if (requestCode == CAMERA_REQUEST) {  
         //pic path
          File picture = new File(Environment.getExternalStorageDirectory() + "/temp.jpg");  
       } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can read XLS file with this code : string path =@c:\r\1.xlsx; OleDbConnection MyConnection
Whi with this code public final String[] array_titoli_serie_prima = new String[]{ getResources().getString(R.string.titolo_p1), getResources().getString(R.string.titolo_p2), getResources().getString(R.string.titolo_p3),
String fileName = String.valueOf(System.currentTimeMillis())+.jpg; String path = Environment.getExternalStorageDirectory().toString() + /puzzlemaker/; FileOutputStream outStream = null;
Suppose I have this code: String encoding = UTF-16; String text = [Hello StackOverflow];
I have this code : String check=SELECT COUNT(*) as check FROM recordstudent WHERE STUDENT_ID=+T_STUDENT_ID+
So i have this code: foreach (string xmlfilelisted in xmlFileList) { resultXml.Root.Add(XDocument.Load(xmlfilelisted).Root.Elements()); resultXml.Save(filepath); }
I have this simple code public String toString() { **Iterator it = list.iterator();** String
I have written this code to convert string in such format 0(532) 222 22
Just curious how you would comment this line of code: string customerNm = customerNm.EndsWith(s)
Background I serialize a very large List<string> using this code: public static string SerializeObjectToXML<T>(T

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.