0

I have successfully settled up Action Bar Sherlock, and I'm fine with it, just a minor issue: if I press an item on the action bar it can't be clicked again until I press back or open/close a submenu or the navigation drawer. I just can't see what I have to modify, I haven't tried nothing, because I don't even know where to start with this, I've just added the item both from xml and code, and I haven't noticed any difference... Any suggestion?

EDIT:


since my item has an animation associated to it's onClick, i've solved like this:

  • make the class implement Runnable;
  • add something like this:

    Thread refreshThread = new Thread(this);
    
  • then put this inside run()

    invalidateOptionsMenu();
    
  • Finally calll this from your ImageView reference

    iv.postOnAnimationDelayed(refreshThread, 1500);  
    

where 1500 is the duration of the animation.

I really don't know if this is the best solution, it just works and doesn't cause any issue.

vinzdef
  • 1,717
  • 2
  • 12
  • 22

1 Answers1

0

Try using invalidateOptionsMenu to force an immediate redraw of the menu. Then you should be able to catch the second press of the button. This post should explain more of what you're looking for. https://stackoverflow.com/a/5767673/2223009

Community
  • 1
  • 1
Rescue9
  • 338
  • 2
  • 7
  • Thanks! That was just what i needed! Just a problem, since my item is animated, the animation isn't executed if i do invalidateOptionsMenu() inside his onClick method, but I've managed to solve this, the solution is in the question, maybe it will be useful for someone else. – vinzdef Jul 05 '13 at 10:15