I use the following code to capture the image.
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,outputFileUri);
startActivityForResult(cameraIntent,CAPT_PHOTO);
It work's fine for the HTC Legend,HTC desire,Samsung galaxy and Samsung galaxy tab.
But in LG optimus opens the camera and save the image file by it's own name and uri. Ho开发者_如何学编程w to solve this?You can try to add an extra Extra: MediaStore.EXTRA_MEDIA_TITLE
where you can define the title of the image. Hope this helps!
choosePhotoImage = Environment.getExternalStorageDirectory()+ "/make_machine_example" + (counter++) + ".jpg";
File file = new File(choosePhotoImage);
Uri outputFileUri = Uri.fromFile(file);
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,outputFileUri);
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
精彩评论