@Override
 protected void onDestroy() {
   try {
     if (amrEncoder != null) {
       amrEncoder.stop();
     }
     if (audioPlayer != null) {
       audioPlayer.stop();
     }
   } catch (Exception e) {
   }
   super.onDestroy();
 }
 private void stopPlayAudio() {
   if (audioPlayer != null) {
     audioPlayer.stop();
   }
 }
 private void startPlayAudio() {
   audioPlayer = AmrAudioPlayer.getAmrAudioPlayerInstance();
   audioPlayer.initAmrAudioPlayer(this);
   audioPlayer.start();
 }