How to touch EditTextPrefences from another activity or another thread

Viewed 45

i have a setting Activity that store name , by changing the name it must first send that to my server and if its store in server successfully then it should set in the summary of my EditTextPreference .

everything works fine but at the end i cant touch the EditTextPreference to set name on it.

this method is in setting activity but called from onPostExecute of the AsyncTask

  public void setNewSetting(Activity activity) {
    EditTextPreference editTextPreference = (EditTextPreference) UserSettingActivity.this.findPreference(activity.getString(R.string.pref_name_key));
    name = sharedPreferences.getString(activity.getString(R.string.pref_name_key), "");
    editTextPreference.setSummary(name);
}

the activity is the setting activity that i passed to the AsyncTask and then passed to method.

my problem is here and give me a nullPoiterException for EditTextPreferences

Sorry for my bad english. and thanks in advance.

1 Answers
Related