public boolean onBackPressed(){
  if (mStack.size() > 1) {
    mStack.pop();
    String key=mStack.peek();
    PreferenceScreen preference=(PreferenceScreen)mRoot.findPreference(key);
    navigateToPreferenceScreen(preference,false);
    return true;
  }
  return false;
}

public boolean onBackPressed ( ) { if ( mStack . size ( ) > 1 ) { mStack . pop ( ) ; String key = mStack . peek ( ) ; PreferenceScreen preference = ( PreferenceScreen ) mRoot . findPreference ( key ) ; navigateToPreferenceScreen ( preference , false ) ; return true ; } return false ; }
provide a mechanism for preference fragment to react to back button presses and call this .
