Student Lab: Creating an Audio Player in AndroidStudio Using Java. Android version 7.0+ Audio file source: file path
This Android application is a fully functional audio player developed in Java using Android Studio. It plays local MP3 files stored in the device's public Downloads directory. The player features a modern UI with image effects, playlist management, and standard playback controls.
- Playlist Support: Manages a queue of four audio tracks.
- Playback Controls:
- Play/Pause (single toggle button)
- Next / Previous track
- Loop (repeat) mode
- Visual Experience:
- Displays a unique cover image for each track.
- Applies dynamic visual effects: rounded corners for the cover and a blurred background.
- Progress Tracking:
- Interactive
SeekBarfor timeline navigation. - Real-time display of current playback time and total track duration.
- Interactive
- Android Permissions: Correctly handles runtime permissions for reading audio files (
READ_MEDIA_AUDIOfor API 33+,READ_EXTERNAL_STORAGEfor lower versions).
- Language: Java
- Minimum SDK: API 24 (Android 7.0 Nougat)
- Core Component:
android.media.MediaPlayer - Audio Format: MP3
- Source: Local file paths (from
Environment.DIRECTORY_DOWNLOADS)
app/src/main/ ├── java/com/example/myapplication/ │ ├── MainActivity.java # Main activity, player logic & UI handling │ └── AudioPlayerEffects.java # Separate class for applying image effects ├── res/layout/ │ └── activity_main.xml # UI layout with RelativeLayout & LinearLayout └── AndroidManifest.xml # App permissions and configuration
- Clone the repository:
git clone https://github.com/your-username/AudioPlayer_labwork.git
- Open the project in Android Studio.
- Prepare Audio Files: Place the following MP3 files in your device's or emulator's
Downloads/folder:kept.mp3angel.mp3baptism.mp3afterdark.mp3(The app is pre-configured to look for these specific filenames).
- Prepare Cover Images: Ensure the corresponding drawable resources (
cc1,kitty1,cc2,kitty2) are present inres/drawable/. - Build and run the app on an emulator or physical device (Android 7.0+).
- Separation of Concerns: The
AudioPlayerEffectsclass isolates image processing logic (blur, rounding) from the main player activity. - MediaPlayer Lifecycle: Properly managed with
prepareAsync(),release(), and event listeners (OnCompletionListener,OnPreparedListener). - State Management: Tracks play/pause status, loop mode, and current track index.
- UI Updates: Uses a
HandlerandRunnablefor smooth progress bar updates.
This project is licensed under the MIT License - see the LICENSE file for details.
- Repository: https://github.com/aok-m/AudioPlayer_labwork
© 2025 Anna A. Petukhova.


