Android recording application example tutorial

This paper shows the implementation method of Android recording in detail in the form of examples, which can be shared for your reference. The specific methods are as follows:

The first is the XML layout file:

The operation effect is shown in the figure below:

The click listener of the button defined in mainactivity starts recording when the button is pressed, and stops recording when the button is released, which is similar to the operation method of wechat.

To start recording, android.media.mediarecorder is used for recording. First, judge whether the SD card exists. If so, create a recording file according to the current time, save it to the predetermined directory, and start recording with the mediarecorder class.

The method of stopping recording is relatively simple.

After testing, the recorded 3gp file can be played normally.

I hope this article will be helpful to your Android program design.

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