Example #1
0
 /**
  * Starts a new Song then create intent to inform.
  *
  * @param position plays song at the position.
  */
 private void startSong(int position) {
   Log.i(TAG, "startSong :" + position);
   // Get song is chosen to play.
   Song song = mPlayList.get(position);
   String duration = song.getDuration();
   if (mPlayer == null) {
     mPlayer = new MediaPlayer();
   }
   try {
     mPlayer.setDataSource(getApplicationContext(), Uri.parse(song.getPath()));
   } catch (IOException e) {
     e.printStackTrace();
   }
   mPlayer.prepareAsync();
   sendBr(IM_PLAYING);
 }