Hi

Your suggestion sounds good. But I haven't been able to figure out how
to use tags with buttons to determine the position. Would you be able
to give me an example?

Thanks,

Abhi

On Dec 22, 10:30 am, WoodManEXP <woodman...@gmail.com> wrote:
> Although I use ListView a lot it has always been a little confusing to
> understand how it manages its views returned from BaseAdapter.getView
> ().
>
> If you know you have just the six list rows, which is not a lot, then
> every time BaseAdapter.getView() is called create the view hierarchy,
> with the button in each row, and return it.
>
> Of course for each button attach a listener with setOnClickListener
> and that listener will get called whenever the button is clicked/
> touched. You can use the tag field of the button view to help you
> determine at click time which button has been clicked.
>
> Or you can instantiate a separate listener for each button and set
> something in the listener class to is the view clicked.
>
> Make the listener a private class under the containing Activity and it
> can easily get at all the state contained in the Activity. Or make the
> Activity an implementer of View.OnClickListener and just pass
> Activity.this to setOnClickListener.
>
> In all cases onClick(View v) will be called whenever the button is
> clicked/touched.
>
> Hope this helps…
>
> On Dec 22, 8:58 am,Abhi<abhishek.r.sha...@gmail.com> wrote:
>
>
>
> > Hi guys,
>
> > All I need is a listview with 6 items, each having an icon, textview
> > and a button/imageview. I want to be able to click the button/
> > imageview to open up a new activity and each row opens up a different
> > activity.
>
> > Any suggestions?
>
> >Abhi
>
> > On Dec 21, 8:11 pm,Abhi<abhishek.r.sha...@gmail.com> wrote:
>
> > > Hi,
>
> > > I am using excerpts from this website 
> > > -http://www.androidguys.com/2008/07/14/fancy-listviews-part-one/
> > > (under Dynamic) to build my own ListView with 6 list rows. I am doing
> > > the exact same thing, but with a button added to each row. I want to
> > > be able to listen to each button click and take action according to
> > > the position of the button pressed.
>
> > > I don't know how to use the onClick and Listener in the above case.
> > > Any help would be appreciated. I have posted this question a number of
> > > times but haven't been able to receive a satisfactory reply.
>
> > > I see that the original post is from Mark Murphy who is an active
> > > member of this group. If I hear from him, nothing like it!
>
> > > Thanks,
>
> > > Abhishek- Hide quoted text -
>
> - Show quoted text -

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