示例#1
0
  private void saveLanguages() {
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
    SharedPreferences.Editor editor = settings.edit();

    editor.putString(Preferences.PREF_LANGUAGE_SPEECH_NAME, speechValues[this.currentIndex]);
    editor.putString(Preferences.PREF_LANGUAGE_WORDS_NAME, wordValues[this.currentIndex]);
    editor.commit();

    Preferences.loadLanguageSettings(getBaseContext());
    TtsSpeaker.setLanguage(speechValues[this.currentIndex]);
  }
示例#2
0
  @Override
  protected void onDestroy() {
    TtsSpeaker.initAgain = true;
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    String languageCode =
        prefs.getString(Preferences.PREF_LANGUAGE_SPEECH_NAME, Preferences.DEFAULT_SPEECH_LANGUAGE);
    TtsSpeaker.setLanguage(languageCode);
    Preferences.loadLanguageSettings(getBaseContext());

    // TODO Auto-generated method stub
    super.onDestroy();
  }