¿Es posible definir una ListPreference en Xml y recuperar el valor de SharedPreferences usando getInt? Aquí está mi xml:¿Cómo se obtiene una ListPreference de Android definida en Xml cuyos valores son enteros?
<ListPreference android:key="@string/prefGestureAccuracyKey"
android:title="@string/prefGestureAccuracyTitle" android:summary="@string/prefGestureAccuracyDesc"
android:entries="@array/prefNumberAccuracyLabels" android:entryValues="@array/prefNumberAccuracyValues"
android:dialogTitle="@string/prefGestureAccuracyDialog"
android:persistent="true" android:defaultValue="2"
android:shouldDisableView="false" />
Y quiero obtener el valor con algo como: int (clave, defaultValue) val = sharedPrefs.getInt.
Por el momento tengo que usar getString y analizar el resultado.
que deberían funcionar de acuerdo con el manual de http://developer.android.com/intl/de/reference/android/content/SharedPreferences.html – Pentium10
I don' t recibe tu pregunta. ¿Qué valor estás dispuesto a obtener? – Macarse
Bueno, Xml crea una preferencia cuyo tipo es String not Entero. Me gustaría una preferencia cuyo valor está fuertemente tipeado como int.Esta pregunta surgió de una anterior que escribí que explica el contexto: http://stackoverflow.com/questions/2705091/how-doi-i-cast-from-int-to-generic-type-integer –