Mark has way more experience than me, so I'll let him give the
definitive answer... But my two cents are that it depends on the
situation. :-)

For example, if the widget for which you are writing the listener will
only appear in this Activity, then having the Activity itself
implement the interface is probably fine. But, say for example you're
creating some layout that appears on all of your activities (maybe a
common group of buttons or something like that), then I would create a
separate reusable listener class that saves you from having to
duplicate code.

Please feel free to correct me if I'm wrong about this general
approach.

On Feb 23, 11:35 am, rhaazy <rha...@gmail.com> wrote:
> Thanks for your input!
>
> Inbetween when I posted this and when I checked it again I ended up
> doing something similiar to what kookamonga did.
>
> After I read your post Mark, I added the implements
> OnItemClickListener to my activity and was able to do just as you
> said!
> This is exactly what I was looking for.
>
> So my next question is, in your opinions, what would be the better way
> to structure this?
>
> 1.) having my activity implement the OnItemClickListener
> 2.) creating an embedded class inside my activity that implements the
> OnItemClickListener
>
> I think I over estimated my ability to jump right into this without
> learning a bit more about the java language.
> Thanks again!

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to