Code example for ListPreference

Methods: setEntriessetEntryValues

0
	 
	 
	public static void setSupportedLanguages(final ListPreference listPref) {
		// BCP 47 code, http://schneegans.de/lv/ 
		 
		listPref.setEntries(entries);
		listPref.setEntryValues(entryValues);
	} 
	 
	public static String getLanguageByCode(String code) {
		int i = 0;
		String l = "English (US)";
		for(String s : entryValues) {
			if(s.equals(code)) {
				l = entries[i];
				break; 
			} 
			++i;
		} 
		return l;