The following things you will learn in this article:
- Implementing MediaPlayer class and using its methods like pause, play and stop.
- Using external files(images, audios, etc) in our project.
- Building the interface of our Music Player Android App.
Step 1: Open a new android project
After opening the Android Studio you have to create a new project using the Empty Activity with language as Java and give your project a unique name as you wish but don’t forget to keep the first alphabet capitalGo to the top left corner and then hit File->New->New Project as shown in the Android Project Ideas for Students College Project 2022 2023.
step 2: Designing the User Interface of the app
In this app, we have used 4 components:
- a imageView– to show our given image for the song
- 3 Buttons:
- a play button to play our song
- a pause button to pause our song
- a stop button to stop our song
(Note: if we press play after pressing the pause then our song will continue playing immediately after where it was paused but if we press play button after stop then our song will play from the beginning) Android Mini Project Topics 2022 2023
These components are implemented on the below two layouts:
- Vertical LinearLayout
- Horizontal LinearLayout
Inside the LinearLayout (vertical) there are two components:
- imageView component
This layout will vertically divide our app screen in two halves. The imageView component will be on upper half and the Horizontal Linear Layout will be on the lower half. The horizontal layout will contain three buttons (play, pause and stop button). This horizontal layout will align these three buttons one after another horizontally on the lower half of our app screen. Android Projects Ideas Titles 2022 2023
To understand this clearly, please go through the following blue print and Component Tree of our app:
Step 5: Let’s Run our app
Click the “Run” button at the Toolbar at the top to run our code.
You can run your app two ways:
- using Android Virtual Device (emulator)
- by connecting your phone using USB
You must enable the developer options in your phone and set the USB debugging mode on to run your app.