title: Calling activity class method from Service class
body: <p>I have seen many posts in SO regarding this but could not get the exact and most easy way to call an activity method from service class. Is broadcast receiver only the option? No easy way out ? I just need to call the following method in Activity class after the media player is prepared in Service class .</p>
  
  <p>Activity class:</p>
  
  <pre><code>    public void updateProgress() {
      // set Progress bar values
      songProgressBar.setProgress(0);
      songProgressBar.setMax(100);
      // Updating progress bar
      updateProgressBar();
  }
  </code></pre>
  
  <p>Service class:</p>
  
  <pre><code>   @Override
  public IBinder onBind(Intent intent) {
      Log.d(this.getClass().getName(), "BIND");
      return musicBind;
  }
  
  @Override
  public boolean onUnbind(Intent intent) {
      return false;
  }
      @Override
  public void onPrepared(MediaPlayer mp) {
      try {
          mp.start();
      } catch (IllegalStateException e) {
          e.printStackTrace();
      }
  
             // updateProgress();// Need to call the Activity method here 
    }
  </code></pre>