title: set mediaPlayer Volume dynamically while playing sound
body: <p>I am having an application in which I am playing a sound with the help of MediaPlayer in a service,which is running properly. But what I want is to set the volume of the sound with the help of seekBar or something dynamically while the sound is being played.
  The code is as follow:</p>
  
  <p>PlayerActivity:</p>
  
  <pre><code>   public void onClick(View src) {
      switch (src.getId()) {
      case R.id.buttonStart:
        Log.d(TAG, "onClick: starting srvice");
  
        startService(new Intent(this, MyService.class));
        break;
      case R.id.buttonStop:
        Log.d(TAG, "onClick: stopping srvice");
  
        stopService(new Intent(this, MyService.class));
        break;
      }
    }
  </code></pre>
  
  <p>MyService.java</p>
  
  <pre><code> @Override
      public void onCreate() {
          player = MediaPlayer.create(this, R.raw.sound);
          player.setLooping(false); // Set looping
      }
  
      @Override
      public void onDestroy() {
          player.stop();
  
      }
  
      @Override
      public void onStart(Intent intent, int startid) {
          player.start();
      }
  </code></pre>
  
  <p>How would I set a seekbar and set the volume of sound while it is playing.
  Thanks.</p>