开发者

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" ....

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜