Android : How set value spinner when change textEdit of preferenceScreen?

on Saturday, September 20, 2014


when Change value of TextEdit of preference Screen, I want that textEdit of ManinActivity change...How can I do?.



@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
if (key.equals(PrefUserName)) {

SharedPreferences sharedPref = PreferenceManager
.getDefaultSharedPreferences(getApplication());

String textoEditTextPreference = sharedPref.getString(key,
"");
// Spinner spinner = (Spinner) findViewById(R.layout.activity_main);


//Here I want add value spinner of main activity...


// Spinner spinner = (Spinner) findViewById(R.layout.activity_main);



Toast.makeText(
getApplication(),
"New name of user: "
+ textoEditTextPreference, Toast.LENGTH_SHORT)
.show();
}


Thanks!!!


0 comments:

Post a Comment