listview - Android list tap event delegation -
i have list uses database display data. there several operations user can perform on each list item , instead of implementing context menu user uses long press bring list of possible operations add buttons each item user can tap button , perform operation. list can potentially large , attaching listener each button each list item overkill javascript programmers event bubbling, i.e. attach single handler top level element entire list , let click events bubble it. how go doing this?
view.onclicklistener.onclick() not bubble, solution propose not work.
otoh, view.ontouchlistener.ontouch() bubble possibly used, require manually handle motionevent's down/up detect click.
besides, if create lot of buttons, sure adding onclick handlers lot of overhead, since can register same method of them.
what trying sounds premature optimization. sure there real overhead affecting users, before try deal it.
Comments
Post a Comment