0

I need to implement some action after clicking the up icon after searching in my ListView via SearchView. How can i get UP event, i.e. how can i implement the click event for UP icon.

Up icon encircled in Red.

BST Kaal
  • 2,993
  • 6
  • 34
  • 52
  • i think what your looking for is `android.R.id.home` , more from [here](http://developer.android.com/training/implementing-navigation/ancestral.html#NavigateUp) – Spurdow Sep 08 '14 at 13:01
  • Nope,I have tried using `android.R.id.home` which didn't work coz this one is associated to `SearchView` widget not to go back to parent or home activity. – BST Kaal Sep 08 '14 at 13:03

1 Answers1

0

Found my own answer, Instead of relying on UP icon event, i implemented OnActionExpandListener which worked exactly what i wanted.

menuItem.setOnActionExpandListener(new OnActionExpandListener()
        {

            @Override
            public boolean onMenuItemActionCollapse(MenuItem item)
            {
                // Do something when collapsed

                return true; // Return true to collapse action view
            }

            @Override
            public boolean onMenuItemActionExpand(MenuItem item)
            {
                // Do something when Expanded
                return true;
            }
        }); 
BST Kaal
  • 2,993
  • 6
  • 34
  • 52