Music Player code for Android application development

Music player code in android :-
Android is the best platform for creating mobile application like music play. It is really easier than creating app in other mobile operating system.
To play a music in android application,you need to create object of MediaPlayer class.

Steps to create music player code for android :-

Use following steps to play any music in your android application

  • Create “raw” folder in “res” folder of your project.
  • Copy any music file from your computer, then paste this file in “raw” folder that you created.
  • Remove extension associated with music file means if it is music.mp3 then rename it as music only.
  • Now take two button in xml layout file one for play and other for stop
  • Now define onClick() event for start button and write following code
¡MediaPlayer mp=MediaPlayer.create(this, R.raw.one);
¡mp.setLooping(false);
¡player.start();
  • Now define onClick() event for stop button and write following code.
  • player.stop();

    Full android web application Tutorial:-

    Introduction How to develope Android application

    What are the Fundamental Units of Android Application

    Step by Step Installation guid for android application developent

    How to Build and Run the Android Application

    Views in Android Application

    Linear Layout in Android Application Development

    Table Layout in Android Application

    Relative Layout in Android Application

    SQLite Database used in Android Application Development

    Music Player Code for Android Application Development

    How to make Phone call for Android Application with full code

    Status Bar in Android Application Development with Full Code

    Comments (0)
    Add Comment