I made a program whose major function is use API to take photos and store them in the path I gave.
But things don't come out right on different phones comparing to that when I tested on the emulator or phone with Google's origin ROM.
Theoretically. If I gave a path to the Intent, the photo shouldn't appear in the phone's default gallery, but on MOTO Defy the photos were stored in both my path and default image directory. And on Samsung, my app crashes silently when return from the camera Intent. And only on some phones I can bring up menu by pressing the menu button in the Camera Activity. And even some of them saves photo as the size I set in the Camera Activity's setting menu.
I think this is because the manufacturers customized the ROM on their phones so the Camera Activity acts differently.
Anyone know how to avoid this situation? Or is there any other way to take photos not by the intent "android.media.action.IMAGE_CAPTURE"
?
The following is the code how I take photos.
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(getpath()+"_.jpg")));
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
startActivityForResult(intent, 0);
The way that @balban shah offered worked all the same when I tried.
Finally I found that's because different manufacturers customize their Rom, including the Camera app, so the best way is not to call the default camera app, instead we can write a activity use hardware.camera
to take picture. There are a lot of examples for this around the Internet too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With