Back to project page android-continuous-voice.
The source code is released under:
Copyright (c) 2015, Marius Fink - Universit?t Hamburg All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following ...
If you think the Android project android-continuous-voice listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package de.uniHamburg.informatik.continuousvoice.services.recognition.builtIn; //from w ww.j a v a2 s.co m import android.os.Bundle; import android.speech.RecognitionListener; import android.speech.SpeechRecognizer; import android.util.Log; public abstract class AbstractAndroidRecognitionListener implements RecognitionListener { private final String TAG = this.getClass().getSimpleName(); @Override public void onBeginningOfSpeech() { } @Override public void onRmsChanged(float rmsdB) { } @Override public void onBufferReceived(byte[] buffer) { } @Override public void onEndOfSpeech() { } protected boolean restartWhenError(int error) { return error != SpeechRecognizer.ERROR_CLIENT && error != SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS; } @Override public void onError(int error) { Log.i(TAG, "onError code:" + error + " message: " + translateError(error)); } protected String translateError(int error) { String message; switch (error) { case SpeechRecognizer.ERROR_AUDIO: message = "Audio recording error"; break; case SpeechRecognizer.ERROR_CLIENT: message = "Client side error"; break; case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS: message = "Insufficient permissions"; break; case SpeechRecognizer.ERROR_NETWORK: message = "Network error"; break; case SpeechRecognizer.ERROR_NETWORK_TIMEOUT: message = "Network timeout"; break; case SpeechRecognizer.ERROR_NO_MATCH: message = "No match"; break; case SpeechRecognizer.ERROR_RECOGNIZER_BUSY: message = "RecognitionService busy"; break; case SpeechRecognizer.ERROR_SERVER: message = "error from server"; break; case SpeechRecognizer.ERROR_SPEECH_TIMEOUT: message = "No speech input"; break; default: message = "Not recognised"; break; } return message; } @Override public void onPartialResults(Bundle partialResults) { } @Override public void onEvent(int eventType, Bundle params) { } }