Android

Java (Android Studio) Tutorial – The Simple Music Player –

 

 

Introduction

In this video, I’ll share how to develop a simple music player with Android Studio.

You’ll learn:
– Media Player class
– Seekbar
– Thread
– Handler

Hope you enjoy 🙂

 
 

Environment

Android Studio 2.2.3
Emulator: Genymotion(Nexus4)

 
 

Video

Java ( Android Studio ) Tutorial – Music Player –

 
 

Download

 

 

ABOUT ME
Sara
Working as a freelance programmer in Japan. I try to make coding as simple as possible. Hope you enjoy coding 🙂
  • Brindha D

    Excellent Programming Skills You have Keep it up>>>

    • Sara

      Hi Brindha, thanks for your comment 🙂

  • Purple Pie Technologies

    Hey , Awesome Tutorial Ever Noticed. Crystal Clear Explanation without voice. All the best. keep up the good work.

    • Sara

      Hi Purple Pie Technologies, thank you for your comment! I’m so glad you found my video 🙂

  • https://plus.google.com/100596404276522305519 Ade Eko Saputra

    hey sara, if my music file have 1 hour long, how to make timelabel for elapsedtime and remainingtime?

    • Sara

      Hi Ade Eko Saputra, thanks for watching 🙂
      Here’s an example of over one-hour long music file.

      public String createTimeLabel(int time) {
       String timeLabel = “”;

       int hour = time / 1000 / 60 / 60;
       int min = time / 1000 / 60;
       int sec = time / 1000 % 60;

       timeLabel += hour + “:”;
       if (min >= 60) {
        timeLabel += min % 60 + “:”;
       } else {
        timeLabel += min + “:”;
       }
       if (sec < 10) timeLabel += "0";
       timeLabel += sec;

       return timeLabel;
      }

      Since the "time" variable is milliseconds, convert milliseconds to hours, minutes, and seconds.
      1 second = 1000 milliseconds.
      1 minute = 1000 * 60 milliseconds.
      1 hour = 1000 * 60 * 60 milliseconds.

      Then, create "timeLabel" to display elapsed time and remaining time.
      % gives you a remainder. For example, when "min" is 78, min % 60 is 18.
      Hope this helps.

  • Mari Emma

    hey, are you know because the “elapsedTimeLabel” and “remainingTimeLabel” have error and in the time is in seconds (sorry I’m no speak English).

  • Yunus YÜRÜK

    likewise, internet URL please