(a) Call camera to save to the specified folder, Intent.putextra (file) to save the captured photos directly to the folder
However, this method can not be used to shoot video, the same in the camera, if the path is passed, the screen card will be dead, while the incoming path will have an empty file, the file name is correct, but no data, and in the callback function Onactivityresult data is not empty, The path name that will be passed in for you. Therefore, it is best not to pass in the storage path when using intent to call the camera, otherwise there will be different problems on different machines, so we can find the files by the default given path.
(b) as follows: Photo shoot
Intent intent=new Intent (); Specifies the ACTION intent.setaction (mediastore.action_image_capture) to turn on the system camera;
Intent.addcategory (Intent.category_default); Create a file based on the address file file=new files (file_path); Convert the file address to URI format URI uri=uri.fromfile (file); Set The storage address Intent.putextra (Mediastore.extra_output, Uri) of the picture file after the system camera takes the photo;
Video:
if (file.exists ()) {
File.delete ();
}
Android Development-Call the system camera to take photos should pay attention to the points.