Finder
Finder

Reputation: 1217

How to Capture Image in Android?

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. How to solve this?

Upvotes: 0

Views: 591

Answers (2)

Kamal
Kamal

Reputation: 1415

   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);

Upvotes: 0

Dimitris Makris
Dimitris Makris

Reputation: 5183

You can try to add an extra Extra: MediaStore.EXTRA_MEDIA_TITLE where you can define the title of the image. Hope this helps!

Upvotes: 1

Related Questions