In my application pressing a list row or a button means executing the same commands. My problem is that the list and the button have different listeners (AdapterView.OnItemClickListener vs. View.OnClickListener). How can I add the code for the 2 views (as a listener) without having duplicate code.
Best Regards
Best way is to write a wrapper class to both Button and List, and have a common listener…. and use them in you project..
but if you are not ready to take this pain, the easiest way is as Octavian told, put the logic in a method, and call it from both the places 🙂