Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"A View as a click Listener" V/s "setting of whole of the activity" as a listener

 
zoheb hassan
Ranch Hand
Posts: 154
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do they differ???

I have the Code for both

Setting a button as a Listener



Setting an activity as an listener



Can You guys help me in Understanding the Diff
Thanks
Zoheb
 
Ankit Garg
Sheriff
Posts: 9519
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no difference except that when you used the anonymous inner class, you don't need to see which view was clicked but in the activity you may need to if you add on click listener to more than one view...
 
zoheb hassan
Ranch Hand
Posts: 154
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ankit thanks for responding, Can You please tell me what am i doing wrong here

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic