Android programming method for recording, saving and playing [download demo source code attached]

This paper describes the method of Android programming to realize the function of recording, saving and playing. Share with you for your reference, as follows:

Recording in Android is relatively simple, recording and saving by using the MediaRecorder class provided by the system, and then calling MediaPlayer to play the playback. The following is the XML configuration file code:

Record in mainactivity with the following code:

At the same time, create a new recordplayer class to play saved recordings, as follows:

At this time, the function codes have been implemented, but an error will be reported at run time! Why? This is what many beginners forget. That is, when Android invocation of the corresponding functions in the development, you must grant the corresponding permissions in the main configuration file, and add the following code in the configuration file:

In addition, for the detailed description of Android permission control, please refer to the complete description of Android manifest functions and permissions

Attachment: demo source code, click here to download.

For more Android related content, readers who are interested can view the special topics of this site: introduction and advanced tutorial of Android development, summary of Android multimedia operation skills (audio, video, recording, etc.), summary of Android view skills, summary of activity operation skills of Android programming, summary of Android operation JSON format data skills Summary of Android resource operation skills and summary of Android control usage

I hope this article will help you in Android programming.

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