I also use the EfficientAdapter BaseAdapter in my ListView.  Is it not
possible for you to use the onItemClick handler, which provides the
list index (i.e., position), to implement your image change?  (That's
what I do.)


On Jul 30, 6:45 pm, Hari <mba.for.d...@gmail.com> wrote:
> Hi Mark,
> Thanks for the Reply.
>
> I might have not stated my question properly.
>
> I have implemented another functionality for onListItemClick().
>
> Each list item has a ImageView and i want the user to be able to
> change this image by selecting from phone's gallery or by taking a
> snap. So i have an onClicklistener() for the image view. How can i
> know which ListItem was clicked? I also would like to update the
> database for this ListItem to save the image byte[] in blob column.
> For this reason i have to know the item that was clicked.
>
> Regards
> Hari
>
> On Jul 29, 8:31 pm, Mark Murphy <mmur...@commonsware.com> wrote:
>
> > The View passed into onListItemClick() is the row. Call findViewById()
> > on that View to retrieve yourImageView.
>
> > On Thu, Jul 29, 2010 at 8:29 PM, Hari <mba.for.d...@gmail.com> wrote:
> > > Hi,
> > > I have implemented a "EfficientAdapter". Each list item is a
> > > LinearLayout of a combination of image and text views.  This
> > > EfficientAdapter is attached to a Array<CustomObject>. Code snippet is
> > > below:
>
> > > [code]
> > > public class ExampleList extends ListActivity {
> > >  private class EfficientAdapter extends BaseAdapter {
> > >    .........
> > >      public View getView(int position, View convertView, ViewGroup
> > > parent) {
> > >           ..........
> > >           //Make the ICON Clickable
> > >          holder.icon.setOnClickListener(mCorkyListener);
> > >      }
>
> > >      class ViewHolder {
> > >            ......
> > >            TextView dateRange;
> > >            ImageViewicon;
> > >            .....
> > >        }
> > >  }
>
> > >  public void onCreate(Bundle savedInstanceState) {.....}
>
> > >  protected void onListItemClick(ListView l, View v, int position,
> > > long id) {.....}
>
> > >  public OnClickListener mCorkyListener = new OnClickListener() {
> > >        public void onClick(View v) {
> > >                // do something when the button is clicked
> > >                Log.i("Item ID", v.getId()+"");
> > >                captureImage();
> > >    }};
>
> > >   .................
> > >  }
> > > [/code]
>
> > > The captureImage() method brings up the option for user to select an
> > > image from Gallery or click a snap.
>
> > > My Problem:
> > > "I DO NOT KNOW" how togetahandleto the image in the list item that
> > > was clicked. I will have refresh the image view with what ever image
> > > was selected by the user.
>
> > > Any leads or pointers in resolving this issue is greatly appreciated
>
> > > Thanks
> > > Hari
>
> > > --
> > > 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
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > _Android Programming Tutorials_ Version 2.9 Available!

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