title: get the selected preference value in android
body: <p>Is there any way to get the newly selected value for a list preference. I have tried to get the values using onClick and onChange methods, but both of them returning the previous value. I understand that the internal state is set after calling this method. Is there any way to get the current selected value for a list preference so that I can pass the value to a binded service to reschedule a timer. Please help me ...</p>
  
  <p>Here s the code I used:</p>
  
  <pre>
     Preference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
  
              @Override
              public boolean onPreferenceChange(Preference preference, Object newValue) {
                  // TODO Auto-generated method stub
                  Context c = getApplicationContext();
                  SharedPreferences sp = preference.getSharedPreferences();
                  String period = sp.getString("prefKey", "defValue");
                  return true;
              }
          });
  </pre>