android - onOptionsItemSelected called twice -
running android 5.0 on nexus 5. app uses v4 support library 21.0.0
. minsdkversion
11 , targetsdkversion
21.
i have activity deriving android.support.v4.app.fragmentactivity
. have number of menu items on action bar. now, if double-tap 1 of action bar's menu items, onoptionsitemselected
called twice resulting in 2 instances of menu-triggered child ctivity! , yes, menu handlers return true
.
i have googled this, couldn't find anything. facing bug, or have missed something? i've implemented in past, , never encountered weird behavior. ideas?
not sure why happens in latest support lib, in past, views, i've used solution -
private long mlastclicktime = 0; protected boolean isnotafastclick() { boolean result = true; if (systemclock.elapsedrealtime() - mlastclicktime < fast_click_threshold) { result = false; } mlastclicktime = systemclock.elapsedrealtime(); return result; }
before handling click events, call method check if fast click.
Comments
Post a Comment