Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
协议错误不支持Android应用程序地址系列?_Android - Fatal编程技术网

协议错误不支持Android应用程序地址系列?

协议错误不支持Android应用程序地址系列?,android,Android,我的代码: 私有静态最终字符串TAG=“TextToSpeechDemo” 它显示03-03 12:01:21.778:D/SntpClient(61):请求时间失败:java.net.SocketException:协议错误不支持地址族 我猜一下。我想,stringfilename=extras.getString(“filename”)应更改为String filename=extras.getString(“文件:/”+“文件名”) 请发布相关的logcat输出以帮助大家理解问题。仍然是相

我的代码:

私有静态最终字符串TAG=“TextToSpeechDemo”


它显示03-03 12:01:21.778:D/SntpClient(61):请求时间失败:java.net.SocketException:协议错误不支持地址族

我猜一下。我想,
stringfilename=extras.getString(“filename”)
应更改为
String filename=extras.getString(“文件:/”+“文件名”)


请发布相关的
logcat
输出以帮助大家理解问题。

仍然是相同的错误日志cat:03-03 12:20:04.347:D/SntpClient(61):请求时间失败:java.net.SocketException:协议不支持的地址族显示:03-03 12:24:22.106:W/KeyCharacterMap(413):使用默认键映射:/system/usr/keychars/qwerty.kcm.bin和03-03 12:24:22.106:W/KeyCharacterMap(413):没有id为0I的键盘我刚刚将其更改为
文件://
很抱歉输入错误。请看看这是否有效。
private TextToSpeech mTts;
private Button mAgainButton;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
 setContentView(R.layout.speak);


TextToSpeech mTts = new TextToSpeech(this,this);
 // Initialize text-to-speech. This is an asynchronous operation.
// The OnInitListener (second argument) is called after initialization completes.
mTts = new TextToSpeech(this,
    this  // TextToSpeech.OnInitListener
    );

// The button is disabled in the layout.
// It will be enabled upon initialization of the TTS engine.
mAgainButton = (Button) findViewById(R.id.again_button);

mAgainButton.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
        sayHello();
    }
});


@Override
public void onInit( int status) {
    // TODO Auto-generated method stub
    // status can be either TextToSpeech.SUCCESS or TextToSpeech.ERROR.
    if (status == TextToSpeech.SUCCESS) {
    // Set preferred language to US english.
    // Note that a language may not be available, and the result will indicate this.
    int result = mTts.setLanguage(Locale.US);
    // Try this someday for some interesting results.
    // int result mTts.setLanguage(Locale.FRANCE);
    if (result == TextToSpeech.LANG_MISSING_DATA ||
    result == TextToSpeech.LANG_NOT_SUPPORTED) {
    // Language data is missing or the language is not supported.
    Log.e(TAG, "Language is not available.");
    } else {
    // Check the documentation for other possible result codes.
    // For example, the language may be available for the locale,
    // but not for the specified country and variant.
    // The TTS engine has been successfully initialized.
    // Allow the user to press the button for the app to speak again.
    mAgainButton.setEnabled(true);
    // Greet the user.
    sayHello();
}
    }
    else {
        // Initialization failed.
        Log.e(TAG, "Could not initialize TextToSpeech.");
        }
        }
private void sayHello() {
    Bundle extras = getIntent().getExtras();

    String filename = extras.getString("filename");
    String filecontent = extras.getString("filecontent");
    mTts.speak(filecontent,
    TextToSpeech.QUEUE_FLUSH, // Drop all pending entries in the playback queue.
    null);
    }