Hi, I've received messages from users that my application crashes after users have used camera. This works fine on my test phone Nexus One. Starting intent -> Uri imageUri = Uri.fromFile(imageFile); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); activity.startActivityForResult(intent, LogicUtils.CAPTURE_IMAGE_ACTIVITY_REQUEST);
As I understand intent is started (since in reports doesn't says that after picture is taken, application crashes) So problem should be in here. Handling Intent results -> @Override public void onActivityResult(int requestCode, int resultCode, final Intent data) { if (requestCode == LogicUtils.CAPTURE_IMAGE_ACTIVITY_REQUEST) { if (resultCode == RESULT_OK) { Thread getPictureFromUri = new Thread(){ @Override public void run() { Bitmap bitmap = null; try{ bitmap = (Bitmap)intent.getExtras().get("data"); saveAndRelease(tempFile, bitmap); //http://www.jondev.net/articles/ Capturing,_Saving,_and_Displaying_an_Image_in_Android_ %281.5,_1.6,_2.0,_2.1,_2.2,_Sense_UI_-_Hero%29 l.i("using the Sense UI"); } catch (NullPointerException ex) { Uri chosenImageUri = intent.getData(); //this works at least for some phone models if(chosenImageUri == null){ chosenImageUri = intent.getParcelableExtra(Intent.EXTRA_STREAM); //Not tested if this works } try { bitmap = Media.getBitmap(context.getContentResolver(), chosenImageUri); saveAndRelease(tempFile, bitmap); } catch (FileNotFoundException e) {} catch (IOException e) {} } catch(Exception e) {} //This image file is same file //as the one that were used to create Uri from and given to the camera intent } }; getPictureFromUri.start(); } else if (resultCode == RESULT_CANCELED) { } } } I assume that camera intent didn't store captured image to given File imageFile. I've tried this with other variations and and haven't managed to resolve this issue. I've use my own camera activity to take photo on phones that use platform 1.6 and older and that works fine. So this isn't platform issue. There must be away to use native camera app to take picture. What do I do wrong? Sorry that I can't give any more information like stack trace. I would really appreciate if somebody with Motorola droid with platform 2.2 could give some input on this code. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en