title: java.lang.illegalStateException randomly occurs when getting mediaPlayer.getCurrentPosition
body: <p>This code works fine song play perfectly but some time randomly going to next song manually crashes application. Happens randomly</p>
  
  <pre><code>    updateSeekBar = new Thread() {
          @Override
          public void run() {
              int runtime = mediaPlayer.getDuration();
              int currentPosition = 0;
              while (currentPosition &lt; runtime) {
                  try {
                      sleep(500);
                      currentPosition = mediaPlayer.getCurrentPosition();//This is where the app crash                        
                      if (seekBar != null) {
                          seekBar.setProgress(currentPosition);
                      }
                  } catch (InterruptedException e) {
                      e.printStackTrace();
                  }
  
              }
          }
      };
  </code></pre>
  
  <p>Crash report</p>
  
  <pre><code>06-10 22:08:53.160 15351-15560/skydeveloper.me.musicx2 E/AndroidRuntime: FATAL EXCEPTION: Thread-6875
                                                                       Process: skydeveloper.me.musicx2, PID: 15351
                                                                       java.lang.IllegalStateException
                                                                           at android.media.MediaPlayer.getCurrentPosition(Native Method)
                                                                           at skydeveloper.me.musicx2.Player$1.run(Player.java:104)
  </code></pre>