当前位置: 首页>>代码示例>>Java>>正文


Java SpeechRecognizer.ERROR_NETWORK属性代码示例

本文整理汇总了Java中android.speech.SpeechRecognizer.ERROR_NETWORK属性的典型用法代码示例。如果您正苦于以下问题:Java SpeechRecognizer.ERROR_NETWORK属性的具体用法?Java SpeechRecognizer.ERROR_NETWORK怎么用?Java SpeechRecognizer.ERROR_NETWORK使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.speech.SpeechRecognizer的用法示例。


在下文中一共展示了SpeechRecognizer.ERROR_NETWORK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getErrorText

private String getErrorText(int errorCode) {
    String message;
    switch (errorCode) {
        case SpeechRecognizer.ERROR_AUDIO:
            return "Audio recording error";
        case SpeechRecognizer.ERROR_CLIENT:
            return "Client side error";
        case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
            return "Insufficient permissions";
        case SpeechRecognizer.ERROR_NETWORK:
            return "Network error";
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            return "Network timeout";
        case SpeechRecognizer.ERROR_NO_MATCH:
            return "No match";
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            return "RecognitionService busy";
        case SpeechRecognizer.ERROR_SERVER:
            return "error from server";
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            return "No speech input";
        default:
            return "Didn't understand, please try again.";
    }
}
 
开发者ID:rafaelaaraujo,项目名称:Face-detect-framework,代码行数:25,代码来源:Zoom.java

示例2: onError

@Override
public void onError(int i) {
    Timber.d("voiceError %d", i);

    stopVoice();

    switch (i) {
        case SpeechRecognizer.ERROR_NETWORK:
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            sendErrorNotification(context.getString(R.string.voiceErrorNoInternet));
            break;
        case SpeechRecognizer.ERROR_NO_MATCH:
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            sendErrorNotification(context.getString(R.string.voiceErrorNoSpeech));
            break;
        default:
            sendErrorNotification(context.getString(R.string.voiceErrorUnknown));
            break;
    }
}
 
开发者ID:matejdro,项目名称:PebbleAndroidCommons,代码行数:20,代码来源:PhoneVoiceProvider.java

示例3: recogError

public static String recogError(int errorCode){
    String message;
    switch (errorCode) {
        case SpeechRecognizer.ERROR_AUDIO:
            message = "音频问题";
            break;
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            message = "没有语音输入";
            break;
        case SpeechRecognizer.ERROR_CLIENT:
            message = "其它客户端错误";
            break;
        case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
            message = "权限不足";
            break;
        case SpeechRecognizer.ERROR_NETWORK:
            message = "网络问题";
            break;
        case SpeechRecognizer.ERROR_NO_MATCH:
            message = "没有匹配的识别结果";
            break;
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            message =  "引擎忙";
            break;
        case SpeechRecognizer.ERROR_SERVER:
            message = "服务端错误";
            break;
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            message = "连接超时";
            break;
        default:
            message = "未知错误:" + errorCode;
            break;
    }
    return message;
}
 
开发者ID:yangyankai,项目名称:Seconds,代码行数:36,代码来源:ErrorTranslation.java

示例4: getErrorText

public static String getErrorText(int errorCode) {
    String message;
    switch (errorCode) {
        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 = "Didn't understand, please try again.";
            break;
    }
    return message;
}
 
开发者ID:inteliedoit,项目名称:thesis-project,代码行数:36,代码来源:CriteriaFinaltermInputActivity.java

示例5: onError

@Override
public void onError(int error) {

    String reason = "";
    if (mResultCallback != null) {
        switch (error) {
            case SpeechRecognizer.ERROR_AUDIO:
                reason = "SpeechRecognizer.ERROR_AUDIO";
                break;
            case SpeechRecognizer.ERROR_CLIENT:
                reason = "SpeechRecognizer.ERROR_CLIENT";
                break;
            case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
                reason = "SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS";
                break;
            case SpeechRecognizer.ERROR_NETWORK:
                reason = "SpeechRecognizer.ERROR_NETWORK";
                break;
            case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
                reason = "SpeechRecognizer.ERROR_NETWORK_TIMEOUT";
                break;
            case SpeechRecognizer.ERROR_NO_MATCH:
                reason = "SpeechRecognizer.ERROR_NO_MATCH";
                break;
            case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
                reason = "SpeechRecognizer.ERROR_RECOGNIZER_BUSY";
                break;
            case SpeechRecognizer.ERROR_SERVER:
                reason = "SpeechRecognizer.ERROR_SERVER";
                break;
            case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
                reason = "SpeechRecognizer.ERROR_SPEECH_TIMEOUT";
                break;
        }

        mResultCallback.onError(reason, error);
    }

}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:39,代码来源:SpeechRecognition.java

示例6: onError

@Override
public void onError(String error, int errorCode) {
    if (eventHandler != null)
        eventHandler.onError(error, errorCode);
    int errorSent = ERROR.SERVER;
    switch (errorCode) {
        case SpeechRecognizer.ERROR_AUDIO:
            errorSent = ERROR.AUDIO;
            break;
        case SpeechRecognizer.ERROR_NETWORK:
            errorSent = ERROR.NETWORK;
            break;
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            errorSent = ERROR.NETWORK_TIMEOUT;
            break;
        case SpeechRecognizer.ERROR_NO_MATCH:
            errorSent = ERROR.NO_MATCH;
            break;
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            errorSent = ERROR.RECOGNIZER_BUSY;
            break;
        case SpeechRecognizer.ERROR_SERVER:
            errorSent = ERROR.SERVER;
            break;
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            errorSent = ERROR.SPEECH_TIMEOUT;
            break;

        default:
            break;
    }
    sf = new ShieldFrame(UIShield.SPEECH_RECOGNIZER_SHIELD.getId(),
            SEND_ERROR);
    sf.addArgument(1, errorSent);
    Log.d("Frame", sf.toString());
    sendShieldFrame(sf, true);
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:37,代码来源:SpeechRecognitionShield.java

示例7: onError

@Override
public void onError(int error) {
    Log.d("TAG", "onError------>");
    StringBuilder sb = new StringBuilder();
    switch (error) {
        case SpeechRecognizer.ERROR_AUDIO:
            sb.append("音频问题");
            break;
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            sb.append("囧..我听不见在说什么..大声点吧!");
            break;
        case SpeechRecognizer.ERROR_CLIENT:
            sb.append("其它客户端错误");
            break;
        case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
            sb.append("权限不足");
            break;
        case SpeechRecognizer.ERROR_NETWORK:
            sb.append("网络问题");
            break;
        case SpeechRecognizer.ERROR_NO_MATCH:
            sb.append("囧..我听不懂你在说什么..");
            break;
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            sb.append("引擎忙");
            break;
        case SpeechRecognizer.ERROR_SERVER:
            sb.append("服务器错误");
            break;
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            sb.append("连接超时");
            break;
    }
    Toast.makeText(RobotActivity.this,
            "出错了 :" + sb, Toast.LENGTH_SHORT).show();
}
 
开发者ID:AleGogogo,项目名称:MaoMaoRobot,代码行数:36,代码来源:RobotActivity.java

示例8: onError

@Override
public void onError(int error) {
    Log.d("TAG", "onError------>");
    StringBuilder sb = new StringBuilder();
    switch (error) {
        case SpeechRecognizer.ERROR_AUDIO:
            sb.append("音频问题");
            break;
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            sb.append("囧..我听不见在说什么..大声点吧!");
            break;
        case SpeechRecognizer.ERROR_CLIENT:
            sb.append("其它客户端错误");
            break;
        case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
            sb.append("权限不足");
            break;
        case SpeechRecognizer.ERROR_NETWORK:
            sb.append("网络问题");
            break;
        case SpeechRecognizer.ERROR_NO_MATCH:
            sb.append("囧..我听不懂你在说什么..");
            break;
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            sb.append("引擎忙");
            break;
        case SpeechRecognizer.ERROR_SERVER:
            sb.append("服务器错误");
            break;
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            sb.append("连接超时");
            break;
    }
    Toast.makeText(MainActivity.this,
            "出错了 :" + sb, Toast.LENGTH_SHORT).show();
}
 
开发者ID:AleGogogo,项目名称:MaoMaoRobot,代码行数:36,代码来源:MainActivity.java

示例9: getErrorText

private String getErrorText(int errorCode) {
  String message;
  switch (errorCode) {
    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 = "Didn't understand, please try again.";
      break;
  }
  return message;
}
 
开发者ID:pbakondy,项目名称:cordova-plugin-speechrecognition,代码行数:36,代码来源:SpeechRecognition.java

示例10: getErrorMsg

public static String getErrorMsg(int errorCode) {
    String message;
    switch (errorCode) {
        case SpeechRecognizer.ERROR_AUDIO:
            message = "Soryy Audio recording error";
            break;
        case SpeechRecognizer.ERROR_CLIENT:
            message = "Sorry Client side error";
            break;
        case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
            message = "Soryy Insufficient permissions kindly grant all requred permisiion";
            break;
        case SpeechRecognizer.ERROR_NETWORK:
            message = "Sorry Network error";
            break;
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            message = "sorry Network timeout";
            break;
        case SpeechRecognizer.ERROR_NO_MATCH:
            message = "Sorry No match";
            break;
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            message = "Sorry RecognitionService busy";
            break;
        case SpeechRecognizer.ERROR_SERVER:
            message = "Sorry error from server";
            break;
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            message = "sorry No speech input";
            break;
        default:
            message = "Sorry Didn't understand, please try again.";
            break;
    }
    return message;
}
 
开发者ID:cehsonu100,项目名称:DroidAssistant,代码行数:36,代码来源:SpeechToTextService.java

示例11: translateError

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;
}
 
开发者ID:vlinhd11,项目名称:android-continuous-voice,代码行数:36,代码来源:AbstractAndroidRecognitionListener.java

示例12: onError

@Override
public void onError(String error, int errorCode) {
    if (eventHandler != null)
        eventHandler.onError(error, errorCode);
    int errorSent = ERROR.SERVER;
    switch (errorCode) {
        case SpeechRecognizer.ERROR_AUDIO:
            errorSent = ERROR.AUDIO;
            break;
        case SpeechRecognizer.ERROR_NETWORK:
            errorSent = ERROR.NETWORK;
            break;
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            errorSent = ERROR.NETWORK_TIMEOUT;
            break;
        case SpeechRecognizer.ERROR_NO_MATCH:
            errorSent = ERROR.NO_MATCH;
            break;
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            errorSent = ERROR.RECOGNIZER_BUSY;
            break;
        case SpeechRecognizer.ERROR_SERVER:
            errorSent = ERROR.SERVER;
            break;
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            errorSent = ERROR.SPEECH_TIMEOUT;
            break;

        default:
            break;
    }
    sf = new ShieldFrame(UIShield.SPEECH_RECOGNIZER_SHIELD.getId(),
            SEND_ERROR);
    sf.addArgument(1, errorSent);
    Log.d("Frame", sf.toString());
    sendShieldFrame(sf, true);
    isWorking = false;
}
 
开发者ID:Integreight,项目名称:1Sheeld-Android-App,代码行数:38,代码来源:SpeechRecognitionShield.java

示例13: onError

@Override
public void onError(int error) {
    switch (error) {
        case SpeechRecognizer.ERROR_AUDIO:
            // 音声データ保存失敗
            Log.d(TAG, "音声データ保存失敗:" + error);
            break;
        case SpeechRecognizer.ERROR_CLIENT:
            // Android端末内のエラー(その他)
            Log.d(TAG, "Android端末内のエラー(その他):" + error);
            break;
        case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
            // 権限無し
            break;
        case SpeechRecognizer.ERROR_NETWORK:
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            // ネットワークエラー
            Toast.makeText(getApplicationContext(), "ネットワークエラーですデバイスの設定を見なおしてください。:" + error, Toast.LENGTH_SHORT).show();
            break;
        case SpeechRecognizer.ERROR_NO_MATCH:
            // 音声認識結果無し
            Toast.makeText(getApplicationContext(), "音声をテキストに変換できませんでした。:" + error, Toast.LENGTH_SHORT).show();
            break;
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            // RecognitionServiceへ要求出せず
            Log.d(TAG, "RecognitionServiceへ要求出せず:" + error);
            break;
        case SpeechRecognizer.ERROR_SERVER:
            // Server側からエラー通知
            Log.d(TAG, "Server側からエラー通知:" + error);
            break;
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            // 音声入力無し
            Toast.makeText(getApplicationContext(), "音声入力がありません。:" + error, Toast.LENGTH_SHORT).show();
            break;
        default:
    }
}
 
开发者ID:yokmama,项目名称:honki_android,代码行数:38,代码来源:MainActivity.java

示例14: onError

@Override
public void onError(int i) {
    switch (i) {
        case SpeechRecognizer.ERROR_AUDIO:
            Log.d("Recognition", "AUDIO ERROR");
            startRecognition();
            break;
        case SpeechRecognizer.ERROR_CLIENT:
            Log.d("Recognition", "CLIENT ERROR");
            startRecognition();
            break;
        case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
            Log.d("Recognition", "PERMISSIONS ERROR");
            break;
        case SpeechRecognizer.ERROR_NETWORK:
            Log.d("Recognition", "NETWORK ERROR");
            startRecognition();
            break;
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            Log.d("Recognition", "NETWORK TIMEOUT ERROR");
            startRecognition();
            break;
        case SpeechRecognizer.ERROR_NO_MATCH:
            Log.d("Recognition", "NO MATCH ERROR");
            startRecognition();
            break;
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            Log.d("Recognition", "BUSY ERROR");
            break;
        case SpeechRecognizer.ERROR_SERVER:
            Log.d("Recognition", "SERVER ERROR");
            startRecognition();
            break;
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            Log.d("Recognition", "SPEECH TIMEOUT ERROR");
            startRecognition();
            break;
    }
}
 
开发者ID:boztalay,项目名称:Erudite,代码行数:39,代码来源:MainActivity.java

示例15: getErrorText

public String getErrorText(int errorCode) {
    Resources res = context.getResources();
    switch (errorCode) {
        case SpeechRecognizer.ERROR_AUDIO: return res.getString(R.string.error_audio);
        case SpeechRecognizer.ERROR_CLIENT: return res.getString(R.string.error_client);
        case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS: return res.getString(R.string.error_permissions);
        case SpeechRecognizer.ERROR_NETWORK: return res.getString(R.string.error_network);
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT: return res.getString(R.string.error_network_timeout);
        case SpeechRecognizer.ERROR_NO_MATCH: return res.getString(R.string.error_nomatch);
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY: return res.getString(R.string.error_busy);
        case SpeechRecognizer.ERROR_SERVER: return res.getString(R.string.error_server);
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT: return res.getString(R.string.error_speech_timeout);
        default: return res.getString(R.string.error_default);
    }
}
 
开发者ID:ericleib,项目名称:blindtale,代码行数:15,代码来源:GoogleSpeechAdapter.java


注:本文中的android.speech.SpeechRecognizer.ERROR_NETWORK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。