Android camera takes pictures

Application scenario:

In the process of Android development, it is sometimes necessary to call the functions of the mobile phone's own devices. This paper focuses on the call of camera photographing function.

Introduction to knowledge points:

Usage rights: call the phone's own device function (camera photographing function), and ensure that the use of the camera and other related features have been correctly declared in androidmanifest.xml.

Class:

1. The inherited class of the surfaceview view, which is embedded with a surface specially used for drawing. You can control the format and size of this surface. The surface view controls where the surface is drawn. 2. Surfaceholder surfaceholder is an abstract interface for controlling the surface. You can use surfaceholder to control the size and format of the surface, or modify the pixels of the surface, monitor the changes of the surface, etc. surfaceholder is a typical interface of surfaceview. 3. Surfaceholder.callback users can implement this interface to receive messages of surface changes. When used in a surfaceview, it is only valid between surfaceholder. Callback. Surfacecreated() and surfaceholder. Callback. Surfacetested(). The method to set the callback is surfaceholder.addcallback.

Usage:

Step 1: create a new Android project cameratest, including two activities: mainactivity and cameraactivity.

Step 2:

activity_ main.xml

MainActivity.java

activity_ camera.xml

CameraActivity.java

Download address: Android camera takes photos

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

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
分享
二维码
< <上一篇
下一篇>>