1

I've got this edit text preference

<EditTextPreference
        android:title="@string/settings_server"
        android:summary="@string/server_name_message"
        android:key="SERVER_NAME" />

It keeps the last value added. How I can delete the hint from it?

Manuel Castro
  • 1,633
  • 3
  • 24
  • 38
  • That's the nature of an EditTextPreference - it stores the value the user enters into it. Do you just want an EditText perhaps? – Mark Smith May 15 '15 at 16:11
  • But the problems is that it don't show the value saved in preference, it shows the last value insert in the edit text box. – Manuel Castro May 15 '15 at 16:14
  • Are you saying that you enter a value into the EditTextPreference, THEN change the preference value from code somewhere else, THEN come back to the EditTextPreference, and it has reverted to its original value? – Mark Smith May 15 '15 at 16:21
  • I try to explain my use case. I' ve got the "server name" preference. If i logout from the app i clear all the preference. When I go to settings if I click on the edittextpreference the hint is the last I put (but there is no value saved in preference) – Manuel Castro May 15 '15 at 16:25
  • Do it in code of course – Xjasz May 15 '15 at 16:31

1 Answers1

0

You can load the preference for an EditTextPreference from an Xml file by creating a sub class of PreferenceActivity and setting the Preference of that element using addPreferencesFromResource();

Abdul Rahman K
  • 664
  • 5
  • 16