From 8515ee846bd76aee86ec5ddfcc4dd1e626dd999c Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Tue, 30 Nov 2010 14:09:55 -0800 Subject: Fix bug 3240444 - add OnMenuVisibilityListener for action bar. Fix bug 3180015 - leaking window handles on configuration change for action bar dropdown menus Rename ActionBar.NavigationCallback to something more consistent with the rest of the API. Change-Id: Ic1fb4c07484c57a72649b30e27d220b18cda6cdf --- docs/html/guide/topics/ui/actionbar.jd | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'docs/html/guide') diff --git a/docs/html/guide/topics/ui/actionbar.jd b/docs/html/guide/topics/ui/actionbar.jd index c3d3482..44d75c1 100644 --- a/docs/html/guide/topics/ui/actionbar.jd +++ b/docs/html/guide/topics/ui/actionbar.jd @@ -455,7 +455,7 @@ Action Bar.

  1. Create a {@link android.widget.SpinnerAdapter} that provides the list of selectable items for the list and the layout to use when drawing each item in the list.
  2. -
  3. Implement {@link android.app.ActionBar.NavigationCallback} to define the behavior when the +
  4. Implement {@link android.app.ActionBar.OnNavigationListener} to define the behavior when the user selects an item from the list.
  5. Turn on navigation mode for the Action Bar with {@link android.app.ActionBar#setNavigationMode setNavigationMode()}. For example: @@ -472,17 +472,17 @@ android.app.ActionBar#setListNavigationCallbacks setListNavigationCallbacks()}. actionBar.setListNavigationCallbacks(mSpinnerAdapter, mNavigationCallback);

    This method takes your {@link android.widget.SpinnerAdapter} and {@link -android.app.ActionBar.NavigationCallback}. More about these next.

    +android.app.ActionBar.OnNavigationListener}. More about these next.

That's the basic setup. The {@link android.widget.SpinnerAdapter} and {@link -android.app.ActionBar.NavigationCallback} is where most of the work is done. There are many ways +android.app.ActionBar.OnNavigationListener} is where most of the work is done. There are many ways you can implement these to define the functionality for your drop-down navigation. Implementing various types of {@link android.widget.SpinnerAdapter} is beyond the scope of this document—you should refer to the class refrence for more information about implementing it or extending an existing implementation. However, below is a simple example for a {@link -android.widget.SpinnerAdapter} and {@link android.app.ActionBar.NavigationCallback} to get you +android.widget.SpinnerAdapter} and {@link android.app.ActionBar.OnNavigationListener} to get you started.

@@ -520,24 +520,24 @@ defined as a resource looks like this:

- +

Example: simple OnNavigationListener

-

Your implementation of {@link android.app.ActionBar.NavigationCallback} is where you handle +

Your implementation of {@link android.app.ActionBar.OnNavigationListener} is where you handle fragment changes or other modifications to your activity when the user selects an item from the drop-down list. There's only one callback method to implement: {@link -android.app.ActionBar.NavigationCallback#onNavigationItemSelected onNavigationItemSelected()}.

+android.app.ActionBar.OnNavigationListener#onNavigationItemSelected onNavigationItemSelected()}.

The {@link -android.app.ActionBar.NavigationCallback#onNavigationItemSelected onNavigationItemSelected()} +android.app.ActionBar.OnNavigationListener#onNavigationItemSelected onNavigationItemSelected()} method receives the position of the item in the list and an item ID provided by the {@link android.widget.SpinnerAdapter}.

Here's an example that instantiates an anonymous implementation of {@link -android.app.ActionBar.NavigationCallback}, which inserts a {@link android.app.Fragment} into the +android.app.ActionBar.OnNavigationListener}, which inserts a {@link android.app.Fragment} into the layout container identified by {@code R.id.fragment_container}:

-mNavigationCallback = new NavigationCallback() {
+mOnNavigationListener = new OnNavigationListener() {
   // Get the same strings provided for the drop-down's ArrayAdapter
   String[] strings = getResources().getStringArray(R.array.action_list);
 
@@ -556,7 +556,7 @@ mNavigationCallback = new NavigationCallback() {
 };
 
-

This instance of {@link android.app.ActionBar.NavigationCallback} can be given to {@link +

This instance of {@link android.app.ActionBar.OnNavigationListener} can be given to {@link android.app.ActionBar#setListNavigationCallbacks setListNavigationCallbacks()}, in step 4 from above.

-- cgit v1.1