• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How to set onclick listener on a custom view

Good day everyone so I'm trying to set a click listener on icons like this bottom nav bar here,it's a custom nav bar I'm making using custom view,the issue is there's no way to call an onclick listener on any of the icons because they were added programmatically and not directly on the layout like buttons or text views,so I just need the logic on how I will add an onclick function or better still override it so it can work with these icons that are added programmatically to the nav bar.


  • IMG_20211004_110327.jpg
    19.2 KB · Views: 138


We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.