How to intercept a click on the "Up" (home button) Button in ActionBarSherlock?
===

I have implemented a search feature for one of my project using **ActionBar Sherlock**. So now I have the search edit text on the ActionBar like in the samples of the official AB sherlock project repo (on github) : [Collapsible action items][1]

My search edit text is filtering a ListView within the activity. When the user starts to type in some characters, the ListView gets filtered. I did it by adding a textWatcher to the search Edit text like this : 

      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
    
        menu.add(Menu.NONE, SEARCH_ACTION_MENU, 0, "Search")
            .setIcon(R.drawable.ic_search)
            .setActionView(R.layout.search_edittext)
            .setShowAsAction(
                MenuItem.SHOW_AS_ACTION_ALWAYS
                    | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
    
        /** We get a reference to the search edit */
        MenuItemWrapper menuItemWrapper = (MenuItemWrapper) menu.getItem(0);
        final EditText searchEdit = (EditText) menuItemWrapper.getActionView();
        /** We add a listener search filter listener */
        searchEdit.addTextChangedListener(filterWatcher); // filterwatcher is a textWatcher
        return true;
      }

When I click on the search icon, the search Edit Text is shown and the user can start to type in things. Also, the home button is displayed as an "Up Home button" (with the left arrow).

Clicking on this arrow will make the search text view disappear but if the user has already started to type in things, the List View is filtered and is not reset when the search Text View is not visible anymore after the user clicks on the home "Up" button.

**My question is** : how can I intercept click on the **"Up"** button to reset my List View ? I think this is the only way I can reset my list.

I have already tried :

  

    @Override
      public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
          case android.R.id.home:
            Log.d(Constants.LOG_TAG, "Home button clicked");
            return true;
    
          default:
            return super.onOptionsItemSelected(item);
        }
      }

It is not working when the "Home button" is displayed as "Up" button.

any help would be appreciated.

thanks in advance,

  [1]: https://github.com/JakeWharton/ActionBarSherlock/blob/master/samples/demos/src/com/actionbarsherlock/sample/demos/CollapsibleActionItem.java