jQuery in Action, 2nd edition*
The moose likes Android and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark ""A View as a click Listener" V/s "setting of whole of the activity" as a listener " Watch ""A View as a click Listener" V/s "setting of whole of the activity" as a listener " New topic
Author

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

zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 146

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

Joined: Aug 03, 2008
Posts: 9291
    
  17

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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 146

Hi Ankit thanks for responding, Can You please tell me what am i doing wrong here

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "A View as a click Listener" V/s "setting of whole of the activity" as a listener
 
Similar Threads
Single onClick method to handle text and button click Android
button problem
my first activity runing happen error:Uncaught handler: thread main exiting due to uncaught exceptio
EditText force closing with getText().toString()
interface and constructor