Code example for ListFragment

Methods: getActivity, onResume, setListAdapter

0
		setHasOptionsMenu(true);
	} 
 
	@Override 
	public void onResume() { 
		super.onResume(); 
		helper = new RestaurantHelper(getActivity());
		preferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
		initList(); 
		preferences.registerOnSharedPreferenceChangeListener(prefListener);
	} 
	 
	private void initList() { 
		if (model != null) {
			model.close();
		} 
		model = helper.getAll(preferences.getString("sort_order", "name"));
		adapter = new RestaurantAdapter(model);
		setListAdapter(adapter);
	} 
	 
	@Override 
	public void onPause() { 
		helper.close();