code: public SoundCloudTrack remove(int trackIndex) {
  
          SoundCloudTrack removedTrack = null;
          ArrayList<SoundCloudTrack> tracks = mSoundCloudPlaylist.getTracks();
  
          // check if track is in the playlist
          if (trackIndex >= 0 && trackIndex < tracks.size()) {
              removedTrack = tracks.remove(trackIndex);
  
              if (tracks.size() == 0) {
                  // track list empty after removal
                  mCurrentTrackIndex = 0;
              } else if (trackIndex == tracks.size()) {
                  // last song removed
                  mCurrentTrackIndex = (mCurrentTrackIndex - 1) % tracks.size();
              } else if (trackIndex >= 0 && trackIndex < mCurrentTrackIndex) {
                  // tracks translated on the right after a deletion before current played one.
                  mCurrentTrackIndex = (mCurrentTrackIndex - 1) % tracks.size();
              }
          }
          return removedTrack;
      }
docs: Remove a track from the SoundCloud player playlist.
  <p/>
  If the track is currently played, it will be stopped before being removed.
  
  @param trackIndex index of the track to be removed.
  @return track removed or null if given index can't be found.