On Jan 14, 11:24 pm, TreKing <treking...@gmail.com> wrote:
> On Sat, Jan 15, 2011 at 12:48 AM, gonzobrains <gonzobra...@gmail.com> wrote:
> > I have a delete button for each of these items in my list, but I am not
> > sure how to connect the delete button's onClick() with the original item in
> > the ArrayList.
>
> You have a getView() method where you build these custom items, I assume.
> You could set the Tag property on each button with the index it's for, then
> when you click the button just pull it out and use that to index.

You could also just make the position int final and use it in the
View.OnClickListener.onClick that you assign to the button in
getView.  Or if you don't want to define the listener inline, just
pass the int to the constructor of the implementation of
View.OnClickListener you create and save the int as a member of that
instance.

Doug

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