[Android] call system camera and camera

Check the system camera source code and find the manifest file

View the intention filter. The action is android.media.action.image_ CAPTURE

Category is android.intent.category.default

Get the intent object and get it through new

Call setaction() method of intent object to set action. Parameter: android.media.action.image_ CAPTURE

Call the setcategory () method of intent object to set the classification. Parameter: android.intent.category.default

Call putextra() method of intent object to transfer data. Parameters: mediastore.extraoutput. Value is URI object. Obtain URI object through URI. Fromfile() method. Parameters are file object

Call the startactivityforresult() method to open

The image file will be saved to the file set above

Rewrite the method onactionresult() to process the picture

Use the command ADB shell to enter the Android system

Use the command ADB pull / XX / xxx.jpg xxx.jpg to export the file

videotape

The code is the same as above, except for the action part, android.media.action.video_ CAPTURE

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>