I believe I remember reading somewhere that Preferences can only be
saved as a String. I ran into this myself and just saved it as a
string and parsed the value out I needed. Also I believe the "numeric"
attribute is deprecated in favor of inputType.
On Thu, 2010-09-16 at 09:49 -0700, Laimonas wrote:
> Hi,
>
> Is there a way how I can tell the Preference Activity that value
> should be saved as integer? So far my all values are saved as
> strings... I can limit input to integers via XML easy:
>
> <EditTextPreference
> android:key="SomeKey"
> android:numeric="integer"
> />
>
> but it is still saved as string and later trying to getInt("SomeKey")
> on preferences object I always get java.lang.ClassCastException:
> java.lang.String.
>
> Is there a way that EditTextPreference value would be saved not as
> string? Or maybe I should use some other type of Preference for
> numeric input?
>
> Thanks!
> Laimonas
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en