Code example for ListFragment

Methods: onCreate, setHasOptionsMenu

0
  SharedPreferences prefs=null;
  OnRestaurantListener listener=null;
   
  @Override 
  public void onCreate(Bundle state) {
    super.onCreate(state);
     
    setHasOptionsMenu(true);
  } 
   
  @Override 
  public void onResume() { 
    super.onResume(); 
     
    helper=new RestaurantHelper(getActivity());
    prefs=PreferenceManager.getDefaultSharedPreferences(getActivity());
    initList(); 
    prefs.registerOnSharedPreferenceChangeListener(prefListener);
  } 
   
  @Override