Enter the menus and delete the playlist.
setting
Enter the menus and play setting list.
Play mode. Play mode Use a component called RadioGroup which has the function of the single item choice. There is a RadioButton in RadioGroup. Multiple RadioButton items can only select one; play mode of the player includes single cycle, random play, play in order etc. MediaPlayer have a monitor, which insures the songs’ playing and complete. When songs played complete, method OnCompletionListener will be triggered. In the method the operation after completion of play will be processed.
The lyrics setting
The lyric present is realized by a button called ToggleButton which includes start and off. When it is open, the lyrics will display, on the contrary, it will be closed. ToogleButton also has a listener, which can obtain different states of ToogleButton. Instantiation (ToggleButton) View is used before using. findViewById (R.i d.l y_lrc); and switch on/off state by using ToggleButton. IsChecked.
The implementation of lyrics present
The format of the lyrics in the player is.Lrc files, in which the lyrics format is stored as the format of "time + lyrics". The following will introduce how to read the lyrics in Lrc and stored in the Android files.
The storage of XML configuration files
The content structure of the Android system is as Fig. 2:
1751
A content called sdcard is the expansion card with audio files and Lrc lyrics file. If we define a formula of BufferedReader buffer = new BufferedReader (new FileReader (new File ("/sdcard/" + + ". Lrc England "musicName))); specified the path of the Lrc files and read the files into BufferReader. Because two storages need to store time and lyrics respectively, we should define two List < String > container to hold the time and the lyrics. When reading LRC, in each line reading, separate time and lyrics though reoccupy algorithm and add into an array, and store in two lists respectively. Because songs will switch between interfaces in playing, the lyrics must be fixed in a file, rather than as an object, therefore, we will put the two list and lyrics into one configuration file.
When writing is finished, android will automatically generate a configuration file in the content data/data/ and /shared_prefs/, which is shown as Fig. 3.
The extension card access functions of mobile phones. The application implements the function of the file browser. As a file browser, it must have the function of browsing. When the program is run to browsing interface, all contents of the files and icons will appear. We can see all the files from the file browser, which also can be edited. This program is designed for adding songs of the player, so browsing function is limited to the media file and content browsing containing media files.
Data storage. When players run normally, because of the switch among interface, in order to avoid the data lost, we need to store some data for temporary or permanent storage. As a kind of mobile phone operating system, Android provides the following ways for data storage: Preference (configuration), File (documents), SQLite data and network. Application component between each other is independent In Android, and data cannot be shared. In order to realize data sharing, Android provides Content Provider components to realize the sharing of data among applications.
1752
Conclusions
Through the development of music player on Android platform, we get a clear understanding of overall process of the system. The core part of the music player is mainly composed of main interface, playlists, menus, play Settings, file browsing and song search. Grasping the development of the six parts, the music player has had the preliminary scale. Based on the function of the six categories, add some other small features.
Music player system realized the basic function of player: play, pause, and stop, up/down a, volume adjustment, lyrics display, play mode, song search, file browser, playlists query, and other functions. This development implicated the popular mobile terminal development technology. This is the combination management of Java language in the open source mobile platform based on Linux system+ + SQLite database support+ SharePreference configuration file. The system realized the music player programming.
This design of music player based on Android system requires elaborate design of the music player framework, by adopting Eclipse3.5 + Java language as technical support of this system, with the Android plug-in tools, and combination of Android SDK2.1 version lead to the comprehensive and smoothly design and development of the mobile terminal.
Acknowledgements
This work was financially supported by project of Technology Department of Jiangxi Province [No 20143BBM26048]and the project of Technology Department of Jiangxi Province [No 2013BBE50051] also gives us lots of help.
References
[1] Xu, J. The Design and Implementation of Music Player Based on Android Platform, Beijing Posts and Telecommunications University, 2011-5:156~178..
[2] Wang, Gai. Guide Introduction of Google Android second version,People's Posts and Telecommunications Publishing House 2009-11:263~287
[3] Sayed Hashimi, Satya Komatineni, Dave MacLean. Master of the Android 2. People's Posts and Telecommunications Publishing House, 2010-12:154~175.
[4] Mark L.Murphy, Li,X. Wu, M interpreted Guide Introduction of Android Development, People's Posts and Telecommunications Publishing House,2010-12:128~156.
[5] Reto Meier, Wang, C. interpreted Advanced Programming (2nd edition). Tsinghua University Press, 2010-12: 241~278.
[6] Ke, Y. The Android Kernel Profiling. Electronic Industry Press, 2011-9: 231~248.
[7] Guo, H. The Android Application Development, Electronic Industry Press. 2010-6: 271~ 279.
[8] Fan Kaiyuan.《J2EE-based Enterprise MIS Design and Implementation 》.Energy Procedia.2011, Vol.11, pp.1972-1977
,3rd International Conference on Management, Education, Information and Control (MEICI 2015)
Design and implementation of the music player based on Android
Junli Xu
College of Information Engineering, Jiangxi University of Technology, Jiangxi Nanchang
Keywords: Android; Music player; Java; Eclipse
Abstract. in order to solve the problem of complex functions and large required memory of mobile phone music player on the current market, a new music player of simple, convenient, less required memory as well as user-friendly is developed. Based on the Android technology, using the Java language and Eclipse programming tools lead to design and coding of music player. The new design mainly realizes six core functions including main play interface, playlists, menus, play settings, file browsing and song search. This player has merits of high performance, simple operation, and run independently on the Android mobile devices. At the same time, the player can also browse and access files in mobile phones.
Introduction
Android is open source code mobile phone operating system that comes out by Google in November 2007. Its appearance has broken the traditional closed mobile phone operating system. Anyone can modify the mobile phone operating system as well as function according to personal preference, which is also the most attractive merit of Android. Music player in this article is application software based on Google Android.
Android’s application on mobile terminals also completely broke the traditional understanding of the mobile terminals. And appreciate music is one of the best ways to relieve pressure in stressful modern society life. Therefore, many kinds of mobile phone players are also developed. However, a lot of players devote to fancy appearance and function, while caused resources wasting to the user's mobile phone, such as large required memory and CPU, which brings a lot of inconvenience as multiple programs running at the same time. For the most ordinary users, many functions are useless. The purpose of this article is to develop a player which can play the mainstream music file format. To browse and query the storage space as well as operation of adding, deleting, and playing can be realized. Meanwhile, this software can play, pause and select songs with latest Btn and next Btn according to users’ requirement as well as set up songs’ order and etc,.
Music player based on Android application is popular in the market at the present. The completing development of Android operating system gives developers a nice platform, which can learn the popular computer technology combining with learned knowledge, and master the latest knowledge, enrich oneself, and enjoy entertainment.
Introduction of developing environment of Android
This chapter is mainly to study and introduce the needed platform for Android music player, and introduction of the needed configuration environment.
© 2015. The authors - Published by Atlantis Press1746
Build developing environment of Android. The applications of Android need to run based on Android environment. The following is the configuration requirement and installation steps of Android development environment.
The required software of the developing environment Operation system: Windows XP、Linux、Windows 7
Software:Android SDK(Software Development Kit)、ADT(Android Development Tool)
IDE environment:Eclipse IDE + ADT Eclipse3 or higher
JDK:Java Runtime Environment virtual machine、Java Development Kit(JDK) Installation steps of the developing environment
Step 1: install the Java virtual machine JDK version - 6
Step 2: install Eclipse3-5 tools; download address: http://www-eclipse-org/downloads/
Step 3: install the Android SDK: first download the Android SDK
Download address: http://developer-android-com/sdk/index-html Step 4:
Install Android ADT plug-in, run Eclipse and select help - > install new software and select add.
Input SDK tools path in the SDK location: D: \ android \ software \ android SDK – Windows and click OK. The Android environment is set up successfully.
The design principle of android application. Twice the result with half the effort will get if an overall study of the principles done before the design and follow them in the operation. The principle of software design mainly includes the following points:
(1) Reliability
The reliability of the software design must be determined. The reliability of the software system refers to the ability to avoid fault occurred in the process of system running, as well as the ability to remedy troubles once the fault occurs.
(2) Reusability
Look for commonness of similar codes, and come out new method abstractly and reasonably. Pay attention to the generic design.
(3) Understandability
The understandability of software not only require clear and readable document, but the simplified structure of software itself, which requires the designer possess keen insight and creativity, and know well about the design objects.
(4) Simple program
To keep the program simple and clear, good programmers can use simple program to solve complex problems.
(5) Testability
Testability means that the created system has a proper data collection to conduct a comprehensive test of the entire system.
(6)The Open-Closed Principal
Module is extensible but cannot be modified. That is to say, extension is open to the existing code in order to adapt to the new requirements. While modify is closed to the categories. Once the design is completed, the categories cannot be modified.
1747
Function and structure design of Android system. This system adopts the modularized program design, and system function is correspondingly divided into function modules, the main modules include:
(1)UI function module design of mobile terminal: the index screen, play screen, music adding page, file management page are realized.
(2) Backstage function module design of mobile terminal: the specific function, music file data storage function and other function are implemented.
Requirement Analysis of System
The feasibility analysis. This section verified that it is feasible to add music player on the Android system from the aspects of economic, technical and social feasibility.
Economic feasibility
To design Android mobile phone music player as long as a computer has the Android development and the application development of Android is free. In addition, mobile phone music player is basic needs for public. The information that which functions are necessary form all the consumers , which functions are needed for some people, and which features are seldom to use is easy to understand. And a lot of research is eliminated, thus saved the spending. Therefore, the whole process of development doesn’t need to spend any money that is economic feasibility.
Technical feasibility
To design a music player which meets the basic requirements, a deep understand of JAVA language, the Eclipse development tools, SQLlite databases, the Android system architecture, application of framework and other technical knowledge are needed.(framework is the core of the application, and rules that all the programmers participating in the development must abide by). Based on the related technology information and resources for Android on the market, and equipped with technical personnel of technology and the spirit of willing to learn, the technology is feasible.
Social feasibility
With the rapid development of the mobile phone market, all kinds of audio and video resources are widely circulated on the Internet. These resources seem ordinary, but have gradually become an indispensable part of people life, which derived the development of all kinds of mobile phone player. But a lot of players devoted to fancy appearance, strong function causing a lot of wasted resources to the user's mobile phone and bringing a lot of inconvenience to the user as multitasking operation is needed. Some functions are useless to ordinary people. Powerful player is a good thing, but a lot of functions are actually useless for most users. Aimed at these problems, developing multiplied audio player which owns the features of simplified functions, common play function, meeting the needs of most users, less required memory and high quality of playing music, maximizes the optimization in performance.
Saturation Overview. This section describes requirements of the system based on basic control functions of players, list management of the player and system setup function of the player according to research results of the project demand.
1748
According to the research results of project demand, the basic requirements of project system and its function structure are presented. And describe the demand of the system through the different angles. The project is divided into the following parts by using diagram: the basic control functions of the player, the playlist management function of the player and system setting function of the player. The player interface requires rational layout, comfortable color, friendly control buttons and concise and beautiful images. According to the Android system requires, the non- response time is 5 seconds. The following is requirements in the music player development application.
Application response time shall not exceed 5 seconds in music playing. Application response time shall not exceed 5 seconds as the music is suspended. Application response time shall not exceed 5 seconds as the music is stopped.
Application response time shall not exceed 5 seconds as Move Next/Move Previous music. Application response time shall not exceed 5 seconds as system listing is required.
System design
In this chapter, design steps and the results of functional modules in the system are given in details.
Introduction of player project. In this section, the App Starting module of the player in the project is introduced, as well as the Android engineering program structure, etc.
Introduction of AppStarting module in the project
Any AppStarting needs AndroidManifest. XML file to start. And any new project content will automatically generate an AndroidManifest. XML file. Configuration files are the core of the whole program, which contains the Android SDK version, and the default Activity in program running. The systems will automatically looking for a logo in AndroidManifest to react the corresponding operation when any component of the program triggers events.
To define the system, the first thing is launching the Activity: Android Activity. There are properties such as action and category in < intent - filter >. Most of these are the default values of the system. Setting the action and category realize the switch between different Activities. When any components of the program is about to use, declaration must be in the Android Manifest. Xml files.
To be clear that authorities must be illustrated as the statement of provider. Each component has a lot of attributes; the program will define different attributes according to different needs.
Introduction of engineering program structure
The basic structure content of Android project includes: the SRC (source code), gen (constant that Android system automatically generates), res (resource file), and the layout of file and pictures in the main storage program interface, which is shown as in fig. 1.
1749
Part of the function design. The main play interface design
Convenience and practical should be fully considered in the design of the main interface. Every Android interface is a visual interface, which has its unique layout configuration files. We can configure various layout and resources files according to the requirements, such as images, text and color reference, which can form different visual interface and glaring effect.
Interface design of adding songs
There are no corresponding songs for the first time login entering the program; users need to add songs to play. Therefore, you need to enter the adding songs’ interface. The empty playlist needs to add songs which can choose from the SD card to add.
Function design of play and Next/Move Previous music
When need to use the player to play appropriate music, click the play button to realize the function.
When need to use the player to switch to the previous song, click on “Move Previous music” button to realize the function.
When need to use the player to play the next song, click on “the next music” button to realize the function.
1750
Playlist design. A view called List View in Android, with the characteristic of Base Adapter attribute. This can display the form of top to bottom or left to right. The default form of the system is each line only shows a Text View, while this playlist realized the user-defined form. The List View shows one music pictures and one song’s name in every row. We defined a class Music Adapter inherited Base Adapter. And expand the adapter through algorithm, in which a picture and a song’s name can be shown in the first line. Because the Base Adapter is an abstract class, we need to implement the abstract method “get View”, which returns a View. View can be displayed on the Activity, so the playlist interface will come out.
The design and realization of play menus. Realization of play menus
Play menus includes six functions, including play, content, add, delete and delete all. The details are as below:
play | Enter the menus, input the song’s name and realize play. |
|
|
content | Enter the menus, input the song’s name and switch to the content window. |
|
|
add | Enter the menus and add songs in the SD card. |
|
|
delete | Enter the menus and delete target songs from database. |
|
|
del
|