Error on the second listen SpeechRecognizer
<p>I have a problem with SpeechRecognizer on android. Here's my code:</p>

<pre><code>public class MyRecognizerListener implements RecognitionListener {

    String id;

    MyRecognizerListener(String id){
        this.id = id;
    }

    @Override
    public void onEndOfSpeech() {
    }

    @Override
    public void onBeginningOfSpeech() {
        Log.d("Speech", "Inizia ad Ascoltare");
    }

    @Override
    public void onReadyForSpeech(Bundle params) {
        Log.d("Speech", "E' pronto ad Ascoltare");
    }

    @Override
    public void onPartialResults(Bundle results) {
            matches = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);

            if(matches.size() &gt; 1) {

                Log.d("Speech", "Risultati Parziali = " + Integer.toString(matches.size()));

                for (int i = 0; i &lt; matches.size(); i++) {
                    Log.d("Speech", matches.get(i));
                }

                if (matches.contains("si") || matches.contains("sì") || matches.contains("Sì")
                        || matches.contains("yes") || matches.contains("ES")) {
                    Opera opera = createOpera(id);
                    startAudio(opera);
                }

                matches = null;
                turnSpeechOff = false;
                speechRecognizer.cancel();
                speechRecognizer.destroy();
                speechRecognizer = null;
            }
    }

    @Override
    public void onEvent(int eventType, Bundle params) {

    }

    @Override
    public void onError(int error) {

        if(turnSpeechOff) {
            Log.d("Speech", Integer.toString(error));
            turnSpeechOff = false;
            speechRecognizer.cancel();
            speechRecognizer.destroy();
            speechRecognizer = null;

        }

    }

    @Override
    public void onRmsChanged(float rmsdB) {

    }

    @Override
    public void onBufferReceived(byte[] buffer) {

    }

    @Override
    public void onResults(Bundle results) {
        matches = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);

        for (int i = 0; i &lt; matches.size(); i++){
            Log.d("Parole",  matches.get(i));
        }

        if(matches.contains("si") || matches.contains("sì") || matches.contains("Sì")
                || matches.contains("yes") || matches.contains("ES")){
            Opera opera = createOpera(id);
            startAudio(opera);
        }

        matches = null;
        turnSpeechOff = false;
        speechRecognizer.cancel();
        speechRecognizer.destroy();
        speechRecognizer = null;
    }

}

public void startAudioAsk(final String art_id){

    if(speechRecognizer != null) {
        return;
    }
    if(audioPlayer == null || !audioPlayer.isPlaying() ) {

        if(operaAudioAsk != null &amp;&amp; operaAudioAsk.equals(art_id)){
            return;
        }

        operaAudioAsk = art_id;
        if(language.equals("IT")) {
            audioPlayer = MediaPlayer.create(this, R.raw.chiedi);
        } else {
            audioPlayer = MediaPlayer.create(this, R.raw.ask);
        }
        audioPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mp) {
                audioPlayer.reset();
                audioPlayer.release();
                int audioTitle;
                if(language.equals("IT")){
                    audioTitle = getResources().getIdentifier(art_id + "_title" + "_it", "raw", getPackageName());
                    audioPlayer = MediaPlayer.create(MainActivity.this, audioTitle);
                } else {
                    audioTitle = getResources().getIdentifier(art_id + "_title" + "_en", "raw", getPackageName());
                    audioPlayer = MediaPlayer.create(MainActivity.this, audioTitle);
                }
                audioPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
                    @Override
                    public void onCompletion(MediaPlayer mp) {
                        askVoice(art_id);
                        audioPlayer.reset();
                        audioPlayer.release();
                        audioPlayer = null;
                    }
                });
                audioPlayer.start();
            }
        });

        audioPlayer.start();
    }
}

public void askVoice(String art_id){
    if(speechRecognizer == null) {
        speechRecognizer = SpeechRecognizer.createSpeechRecognizer(this);
        speechRecognizer.setRecognitionListener(new MyRecognizerListener(art_id));
        Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getPackageName());
        intent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
        intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);
        intent.putExtra(RecognizerIntent.EXTRA_WEB_SEARCH_ONLY, true);
        if(language.equals("IT")){
            intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "it");
        } else {
            intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en_US");
        }
        speechRecognizer.startListening(intent);
        voiceTimer = new Timer();
        voiceTimer.schedule(new StopVoiceManager(), 2000);
        Log.d("Speech", "Starta");
    }
}

public void stopVoice(){
    if(speechRecognizer != null){
        Log.d("Speech", "Cancello");
        turnSpeechOff = true;
        speechRecognizer.stopListening();
    }
}

public class StopVoiceManager extends TimerTask{

    @Override
    public void run() {

        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                stopVoice();
                Log.d("Speech", "Prova a Cancellare");
            }
        });
    }
}
</code></pre>

<p>As you can see, there's also a task that, after 2 seconds, calls speechRecognizer.stoplistening().</p>

<p>The first listening is ok, I say "yes" and it recognizes it, but the second listening raises the ERROR_CLIENT and it doesn't recognize anything, then the third listening returns to be ok, the fourth doesn't recognize anything and so.</p>

<p>How can i fix this bug?</p>