title: How to change volume of MediaPlayer in service?
body: <p>I have an Activity (let call it A) and service (let call it B) with music player in it.</p>
  
  <p>In A there's a seekbar, and I want to change MediaPlayer's volume with it.
  Any ideas?</p>
  
  <p>In MainActivity:</p>
  
  <pre><code>MusicService mms;
  mms = new MusicService();
  
  Settings_Sound_Music_Volume.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {       
      @Override       
      public void onStopTrackingTouch(SeekBar seekBar) {               
          sdm.setSetting("SETTINGS_MUSIC_VOLUME",String.valueOf(Settings_Sound_Music_Volume.getProgress()));
          mms.player.setVolume(Settings_Sound_Music_Volume.getProgress(), Settings_Sound_Music_Volume.getProgress());
      }       
      @Override       
      public void onStartTrackingTouch(SeekBar seekBar) {     
          // TODO Auto-generated method stub
      }       
      @Override       
      public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) {
          // TODO Auto-generated method stub      
          Settings_Sound_Music_VolumeValue.setText(String.valueOf(progress) + "%");
      }
  });
  </code></pre>
  
  <p>But this code crashes my app. I get a NullPointerException at this line: <code>mms.player.setVolume(...);</code></p>