[Android] Call system camera and camera

Source: Internet
Author: User

Check the system camera source, find the manifest file view

View Intent filter,action is Android.media.action.IMAGE_CAPTURE

Category is Android.intent.category.DEFAULT

Get Intent object, come out with new

Call the setaction () method of the Intent Object , set the action, parameter:android.media.action.IMAGE_ CAPTURE

Call intent setcategory ()

Call the PutExtra () method of the Intent object , pass the data, parameters:mediastore.extraoutput, value is a Uri object, by Uri.fromfile () method gets Uri object, parameter is File Object

Call the Startactivityforresult () method to open the

The picture file is saved to the file set above

Override method Onactionresult () to process the image

Using the command adb shell to enter the android system

Using the command adb pull/xx/xxx.jpg xxx.jpg, the exported file

Video

The code is the same as above, except for the action section,Android.media.action.VIDEO_CAPTURE

[Android] Call system camera and camera

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.