Android: EditTextPreference converts String to numeric
I have a simple PreferenceActivity with an EditTextPreference. My problem is that I set the default text to be a phone number (such as +14047开发者_如何转开发771000) but when the preference is clicked it is shown as a double (in the above example - 1.404771E10). What can I do to prevent this and display the text as String? thanks, Joel
edit: Here is the xml:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:title="IMS Preferences">
<PreferenceCategory android:title="Sip User">
<EditTextPreference android:key="PublicId"
android:title="Public ID" android:defaultValue="+14047771000"/>
</PreferenceCategory>
</PreferenceScreen>
EDIT: anyone? any idea?
You can / need to set the text type in the xml declaration. E.g.
<EditText android:inputType="phone" ....
精彩评论