android - Display the text back to TextPref -


need display text input provided in text preference

    preferencecategory generalprefcat = new preferencecategory(this);     generalprefcat.settitle("general settings");     root.addpreference(generalprefcat);      // name preference     edittextpreference namepref = new edittextpreference(this);     namepref.setdialogtitle("your name");     namepref.setkey("yourname_preference");     namepref.settitle("your name");             generalprefcat.addpreference(namepref); 

need display name entered summary.namepref.setsummary("santosh"). first time if not entered nothing should displayed.

   sharedpreferences mypreference=preferencemanager.getdefaultsharedpreferences(this);    namepref.setsummary(mypreference.getstring("yourname_preference", ""))); 

how input string , display back?

thanks in advanced.

i'm not sure you're after i'll give shot. if wan't specific string settings.getstring if there no saved string under key, can add string second parameter in method. this:

mysettings.getstring("user_string", "this_is_the_default_string"); 

if isn't you're looking for, please try make question clearer.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -