Commit 04813469 authored by Martin Storsjö's avatar Martin Storsjö

Fix handling of the aout preference as an integer

The ListPreference item always handles the chosen value as a string,
therefore conversion from a string to a integer is necessary each
time the preference is set or when loaded from the stored preferences.
Signed-off-by: Martin Storsjö's avatarMartin Storsjö <martin@martin.st>
parent 84ed2b72
......@@ -156,7 +156,11 @@ public class LibVLC {
public static synchronized void useIOMX(Context context) {
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
sUseIomx = pref.getBoolean("enable_iomx", false);
sAout = pref.getInt("aout", AOUT_AUDIOTRACK_JAVA);
try {
sAout = Integer.parseInt(pref.getString("aout", String.valueOf(AOUT_AUDIOTRACK_JAVA)));
} catch (NumberFormatException nfe) {
sAout = AOUT_AUDIOTRACK_JAVA;
}
}
public static synchronized void setAout(Context context, Integer aoutPref,
......
......@@ -157,7 +157,7 @@ public class PreferencesActivity extends PreferenceActivity {
aoutPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
LibVLC.setAout(PreferencesActivity.this, (Integer) newValue, true);
LibVLC.setAout(PreferencesActivity.this, Integer.valueOf((String) newValue), true);
return true;
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment