Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.WazaBe.HoloEverywhere.preference;
  
  import android.os.Bundle;
  import android.os.Handler;
  import android.os.Message;
 
 
 public abstract class PreferenceFragment extends Fragment implements
Interface that PreferenceFragment's containing activity should implement to be able to process preference items that wish to switch to a new fragment.
 
 	public interface OnPreferenceStartFragmentCallback {
Called when the user has clicked on a Preference that has a fragment class name associated with it. The implementation to should instantiate and switch to an instance of the given fragment.
 
 				Preference pref);
 	}

The starting request code given out to preference framework.
 
 	private static final int FIRST_REQUEST_CODE = 100;
 	private static final int MSG_BIND_PREFERENCES = 1;
 	private static final String PREFERENCES_TAG = "android:preferences";
 	private Handler mHandler = new Handler() {
 		public void handleMessage(Message msg) {
 			switch (msg.what) {
 
 				break;
 			}
 		}
 	};
 
 	private boolean mHavePrefs;
 
 	private boolean mInitDone;
 	private ListView mList;
 
 
 		public boolean onKey(View vint keyCodeKeyEvent event) {
 			Object selectedItem = .getSelectedItem();
 			if (selectedItem instanceof Preference) {
 				View selectedView = .getSelectedView();
 				return ((PreferenceselectedItem).onKey(selectedViewkeyCode,
 						event);
 			}
 			return false;
 		}
 
 	};
 
 
 	final private Runnable mRequestFocus = new Runnable() {
 		public void run() {
 		}
 	};

Adds preferences from activities that match the given android.content.Intent.

Parameters:
intent The android.content.Intent to query activities.
 
 	public void addPreferencesFromIntent(Intent intent) {
 
 	}

Inflates the given XML resource and adds the preference hierarchy to the current preference hierarchy.

Parameters:
preferencesResId The XML resource ID to inflate.
	public void addPreferencesFromResource(int preferencesResId) {
				getActivity(), preferencesResIdgetPreferenceScreen()));
	}
	private void bindPreferences() {
		final PreferenceScreen preferenceScreen = getPreferenceScreen();
		if (preferenceScreen != null) {
			preferenceScreen.bind(getListView());
		}
	}
	private void ensureList() {
		if ( != null) {
			return;
		}
		View root = getView();
		if (root == null) {
			throw new IllegalStateException("Content view not yet created");
		}
		View rawListView = root.findViewById(...);
		if (!(rawListView instanceof ListView)) {
			throw new RuntimeException(
					"Content has view with id attribute 'android.R.id.list' "
"that is not a ListView class");
		}
		 = (ListViewrawListView;
		if ( == null) {
			throw new RuntimeException(
					"Your content must have a ListView whose id attribute is "
"'android.R.id.list'");
		}
	}

Finds a Preference based on its key.

Parameters:
key The key of the preference to retrieve.
Returns:
The Preference with the key, or null.
See also:
PreferenceGroup.findPreference(java.lang.CharSequence)
		if ( == null) {
			return null;
		}
	}

Hide:
	public ListView getListView() {
		return ;
	}

Returns the PreferenceManager used by this fragment.

Returns:
The PreferenceManager.
	}

Gets the root of the preference hierarchy that this fragment is showing.

Returns:
The PreferenceScreen that is the root of the preference hierarchy.
	}
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		if () {
		}
		 = true;
		if (savedInstanceState != null) {
			Bundle container = savedInstanceState.getBundle();
			if (container != null) {
				final PreferenceScreen preferenceScreen = getPreferenceScreen();
				if (preferenceScreen != null) {
					preferenceScreen.restoreHierarchyState(container);
				}
			}
		}
	}
	public void onActivityResult(int requestCodeint resultCodeIntent data) {
		super.onActivityResult(requestCoderesultCodedata);
				.dispatchActivityResult(requestCoderesultCodedata);
	}
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}
	public View onCreateView(LayoutInflater inflaterViewGroup container,
			Bundle savedInstanceState) {
		return inflater.inflate(..container,
				false);
	}
	public void onDestroy() {
		super.onDestroy();
	}
	public void onDestroyView() {
		 = null;
	}

	public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
			Preference preference) {
		if (preference.getFragment() != null
					.onPreferenceStartFragment(thispreference);
		}
		return false;
	}
	public void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		final PreferenceScreen preferenceScreen = getPreferenceScreen();
		if (preferenceScreen != null) {
			Bundle container = new Bundle();
			preferenceScreen.saveHierarchyState(container);
			outState.putBundle(container);
		}
	}
	public void onStart() {
		super.onStart();
	}
	public void onStop() {
		super.onStop();
	}
	private void postBindPreferences() {
			return;
		}
	}
	private void requirePreferenceManager() {
		if ( == null) {
			throw new RuntimeException(
					"This should be called after super.onCreate.");
		}
	}

Sets the root of the preference hierarchy that this fragment is showing.

Parameters:
preferenceScreen The root PreferenceScreen of the preference hierarchy.
	public void setPreferenceScreen(PreferenceScreen preferenceScreen) {
		if (.setPreferences(preferenceScreen)
				&& preferenceScreen != null) {
			 = true;
			if () {
			}
		}
	}
New to GrepCode? Check out our FAQ X