Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Actionbar dropdown click event

I have dropdown list in actionbar as navigation list. Using ActionBar.OnNavigationListener and onNavigationItemSelected to detect when user has clicked on item in actionbar dropdown navigation list and that works fine.

However, onNavigationItemSelected is not called if user has clicked on the same item as the one which is currently selected in dropdown list! (I need this exact functionality behavior for app to work properly)

So is there any way to detect click on any part of the dropdown list in actionbar?

Is there a way to somehow reference dropdown view in actionbar, and then set onclicklistner on that dropdown object in actionbar. Like when we use dropdown list in standard layout?

like image 586
VladacusB Avatar asked Sep 28 '12 08:09

VladacusB


1 Answers

The problem here is the same as with any other Spinner. The workariund for this is clearly described here: Spinner : onItemSelected not called when selected item remains the same

However for the ActionBar the solution can be a bit tricky (except for when you are using the ActionBarSherlock and can explicitly mess with its code)

like image 133
Alex Semeniuk Avatar answered Oct 23 '22 16:10

Alex Semeniuk