title: Pause Phone Ringtone while Speaking through Text To Speech and then Resume
body: <p>I am making a caller speaking application which speak caller name using TTS. I want to pause the ringtone while TTS is speaking then resuming the ringtone. From what i have researched we can use <code>AudioFocus</code> (hope so). 
  Anyway i am using the following code </p>
  
  <p><strong>Update</strong></p>
  
  <p>I am using this code now. </p>
  
  <pre><code>public void speak(final String talk) throws InterruptedException {
       final AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
       int musicVolume= audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
       audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, musicVolume, 0);
       audioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
  
      int result = tts.setOnUtteranceProgressListener(new UtteranceProgressListener() {
  
          @Override
          public void onStart(String utteranceId) {
              // TODO Auto-generated method stub
  
          }
  
          @Override
          public void onError(String utteranceId) {
              // TODO Auto-generated method stub
  
          }
  
          @Override
          public void onDone(String utteranceId) {
              // TODO Auto-generated method stub
              audioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
              System.out.println("done");
          }
      });
      HashMap&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
      params.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID,"stringId");
      tts.speak(talk, TextToSpeech.QUEUE_FLUSH, params);
      System.out.println("speaking after tts is over" + talk+" "+result);
  
  }
  </code></pre>
  
  <p>Although the <code>Ringtone</code> is stopped and <code>tts</code> is played but after <code>tts</code> is played <code>Ringtone</code> is not resumed. What should i do?</p>