Introduction: HOW TO MAKE a SIMPLE MUSIC PLAYER APP FOR ANDROID USING ANDROID STUDIO.
Hello Folks! Welcome to the world of android ,in this tutorial we will learn how to make a simple music player application with built in audio player class in android studio.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Project Requirements
Things You will required :
1. Android Studio (Official IDE by Google)
2. Windows/Mac/Linux system with 4GB ram .
Step 2: Preparing the Layout
For making a music player app it is important to understand the basic structure of the app that we will make.
In this tutorial , we will make a simple layout with play/pause and stop button included.
Further you can add more buttons like shuffle/repeat fast/forward/backward and many more.
For creating button just go to the layout.XML file then go to the design section at the bottom of the console and click on widgets then add buttons you can also view the runtime layout in this section.
Step 3: Writing a Main Java File for App
Now, The main task is to write a java code for a app that will guide the application as directed we want.
Android studio provides inbuilt classes that are able to build some basic core applications .
Audio player is the class we will use in this application.
Now, we need to perform actions for each and every buttons that we have provided in the layout file.
OnClicklistener is the key to implement the actions .
The code is provided in the images above.
Step 4: Now It's Time to Compile the Code and Run the Application in Emulator.
After successful coding your all the basic activity java and layout XML files it's time to test the application .
Either you can test the app in emulator or you can test it in your smartphone just enable USB debugging in the developer options and you are ready to go.
The final view of the app will be like the image provided above.
One more thing is that , you can decide whether the app can read the data from sdcard or you can embed the songs in the player itself just by creating a directory called raw in the project root tree and just copy the song files with lowercase letters as a name of the file.
Thanks for reading .