> Also posted on Stack Overflow.
Where you received a very well-written answer.
> I'd like the row itself to maintain knowledge about its own identity and
> responsibility rather than having to leak the knowledge about each row to be
> maintained by the implementer of onItemClickListener.
As the answer on StackOveflow illustrates, the notion of separation of
concerns does not imply that you need to avoid onListItemClick() /
onItemClickListener().
> I'd also like to know what the performance implications are of doing this
> vs. implementing my own logic to figure out how to handle the click.
Done properly, they should be equivalent.
> Are there drawbacks to implementing onClickListener for each ListView
> ArrayAdapter row instead of onItemClickListener? I'm looking for concrete
> data and specific drawbacks rather than vague recommendations.
Row recycling will be trickier, as you need to remember to remove your
listener. Since you're heading down a path that few use, there may be
other issues (e.g., something in ListView/AbsListView interfering with
your per-row click events). And, as the StackOverflow answer
illustrates, there is no need to run any of these risks to achieve
your aims.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
Android App Developer Books: http://commonsware.com/books
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment