xml - My EditTextPreference is not updaing after adding string to Dialog -


i've added edittextpreference settings.xml code below

    <edittextpreference         android:key="prefdeviceuser"         android:title="user name"         android:summary="please add user name." /> 

when run dialog box appears when add name doesn't update , still says 'please add..' have left out?

please create own edittextpreference. achieve result need override getsummary method.

public class edittextpreference extends android.preference.edittextpreference{      public edittextpreference(context context, attributeset attrs, int defstyle) {         super(context, attrs, defstyle);     }      public edittextpreference(context context, attributeset attrs) {         super(context, attrs);     }      public edittextpreference(context context) {         super(context);     }      @override     public charsequence getsummary() {         string summary = super.getsummary().tostring();         return string.format(summary, gettext());     } } 

then use in preferences.xml file, newly created edittextpreference, , in summary set value strings.xml this:

android:summary="@string/string_val" 

and in strings.xml looks this:

please select user. set is: %s

final summary then: please select user. set is: selectedvalue


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -