Most visited

Recently visited

Added in API level 11
Deprecated since API level 21

FragmentBreadCrumbs

public class FragmentBreadCrumbs
extends ViewGroup implements FragmentManager.OnBackStackChangedListener

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.app.FragmentBreadCrumbs


This class was deprecated in API level 21.
This widget is no longer supported.

Helper class for showing "bread crumbs" representing the fragment stack in an activity. This is intended to be used with ActionBar.setCustomView(View) to place the bread crumbs in the action bar.

The default style for this view is Widget_FragmentBreadCrumbs.

Summary

Nested classes

interface FragmentBreadCrumbs.OnBreadCrumbClickListener

Interface to intercept clicks on the bread crumbs. 

Inherited XML attributes

From class android.view.ViewGroup
From class android.view.View

Inherited constants

From class android.view.ViewGroup
From class android.view.View

Inherited fields

From class android.view.View

Public constructors

FragmentBreadCrumbs(Context context)
FragmentBreadCrumbs(Context context, AttributeSet attrs)
FragmentBreadCrumbs(Context context, AttributeSet attrs, int defStyleAttr)

Public methods

void onBackStackChanged()

Called whenever the contents of the back stack change.

void setActivity(Activity a)

Attach the bread crumbs to their activity.

void setMaxVisible(int visibleCrumbs)

The maximum number of breadcrumbs to show.

void setOnBreadCrumbClickListener(FragmentBreadCrumbs.OnBreadCrumbClickListener listener)

Sets a listener for clicks on the bread crumbs.

void setParentTitle(CharSequence title, CharSequence shortTitle, View.OnClickListener listener)

Inserts an optional parent entry at the first position in the breadcrumbs.

void setTitle(CharSequence title, CharSequence shortTitle)

Set a custom title for the bread crumbs.

Protected methods

void onLayout(boolean changed, int l, int t, int r, int b)

Called from layout when this view should assign a size and position to each of its children.

void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Measure the view and its content to determine the measured width and the measured height.

Inherited methods

From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.view.ViewParent
From interface android.view.ViewManager
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource
From interface android.app.FragmentManager.OnBackStackChangedListener

Public constructors

FragmentBreadCrumbs

Added in API level 11
FragmentBreadCrumbs (Context context)

Parameters
context Context

FragmentBreadCrumbs

Added in API level 11
FragmentBreadCrumbs (Context context, 
                AttributeSet attrs)

Parameters
context Context
attrs AttributeSet

FragmentBreadCrumbs

Added in API level 11
FragmentBreadCrumbs (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context
attrs AttributeSet
defStyleAttr int

Public methods

onBackStackChanged

Added in API level 11
void onBackStackChanged ()

Called whenever the contents of the back stack change.

setActivity

Added in API level 11
void setActivity (Activity a)

Attach the bread crumbs to their activity. This must be called once when creating the bread crumbs.

Parameters
a Activity

setMaxVisible

Added in API level 11
void setMaxVisible (int visibleCrumbs)

The maximum number of breadcrumbs to show. Older fragment headers will be hidden from view.

Parameters
visibleCrumbs int: the number of visible breadcrumbs. This should be greater than zero.

setOnBreadCrumbClickListener

Added in API level 12
void setOnBreadCrumbClickListener (FragmentBreadCrumbs.OnBreadCrumbClickListener listener)

Sets a listener for clicks on the bread crumbs. This will be called before the default click action is performed.

Parameters
listener FragmentBreadCrumbs.OnBreadCrumbClickListener: The new listener to set. Replaces any existing listener.

setParentTitle

Added in API level 11
void setParentTitle (CharSequence title, 
                CharSequence shortTitle, 
                View.OnClickListener listener)

Inserts an optional parent entry at the first position in the breadcrumbs. Selecting this entry will result in a call to the specified listener's onClick(View) method.

Parameters
title CharSequence: the title for the parent entry
shortTitle CharSequence: the short title for the parent entry
listener View.OnClickListener: the View.OnClickListener to be called when clicked. A null will result in no action being taken when the parent entry is clicked.

setTitle

Added in API level 11
void setTitle (CharSequence title, 
                CharSequence shortTitle)

Set a custom title for the bread crumbs. This will be the first entry shown at the left, representing the root of the bread crumbs. If the title is null, it will not be shown.

Parameters
title CharSequence
shortTitle CharSequence

Protected methods

onLayout

Added in API level 11
void onLayout (boolean changed, 
                int l, 
                int t, 
                int r, 
                int b)

Called from layout when this view should assign a size and position to each of its children. Derived classes with children should override this method and call layout on each of their children.

Parameters
changed boolean: This is a new size or position for this view
l int: Left position, relative to parent
t int: Top position, relative to parent
r int: Right position, relative to parent
b int: Bottom position, relative to parent

onMeasure

Added in API level 11
void onMeasure (int widthMeasureSpec, 
                int heightMeasureSpec)

Measure the view and its content to determine the measured width and the measured height. This method is invoked by measure(int, int) and should be overridden by subclasses to provide accurate and efficient measurement of their contents.

CONTRACT: When overriding this method, you must call setMeasuredDimension(int, int) to store the measured width and height of this view. Failure to do so will trigger an IllegalStateException, thrown by measure(int, int). Calling the superclass' onMeasure(int, int) is a valid use.

The base class implementation of measure defaults to the background size, unless a larger size is allowed by the MeasureSpec. Subclasses should override onMeasure(int, int) to provide better measurements of their content.

If this method is overridden, it is the subclass's responsibility to make sure the measured height and width are at least the view's minimum height and width (getSuggestedMinimumHeight() and getSuggestedMinimumWidth()).

Parameters
widthMeasureSpec int: horizontal space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.
heightMeasureSpec int: vertical space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.

Hooray!