I have a list preference with two values and I want to update these two values from with values from another array.
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
Resources resources = this.getResources();
String languageData = prefs.getString("languageAlias", " ");
String[] languageAlias = resources.getStringArray(R.array.languageAlias);
String[] voiceData = resources.getStringArray(R.array.voiceData);
int a = 0;
for(a=0; a<languageAlias.length; a++){
if(languageData.equals(languageAlias[a]))
{
//this is where I have problems
prefs.edit().putString("voiceAlias", voiceData[2*a]);
prefs.edit().commit();
break;
}
I have been able to get it working up until I have to use the puString command to make the change and commit. Also how do I specify which item in the list preference I want to change, as all I am required to pass to the putString function is a key?