So after more testing and playing around i was able to figure out where to 
place the code, since it would work with the URL returned from the web 
service.

Placed it within my adapter, but it only loads the first image for the 
first record. From the examples ive found online, i believe it to be within 
the view logic in the adapter, but not sure and not sure where to change it.

Here is the entire adapter and what works for the first image/record only, 
the rest never show up a image, no matter how long i leave the app open.

Can anyone tell me if you see anything wrong with how i implemented the 
image loader?

public class CustomListView extends ArrayAdapter<InventoryItem>
{
    Activity context;
    int layoutResourceId;
    InventoryItem items[] = null;

    public CustomListView(Activity context,int 
layoutResourceId,InventoryItem[] items)
    {
        super(context, layoutResourceId, items);
        this.context = context;
        this.layoutResourceId = layoutResourceId;
        this.items = items;
    }

    @Override
    public View getView(int position, View view, ViewGroup parent)
    {
        View row = view;
        ItemsHolder holder = null;

        if(row == null)
        {
            LayoutInflater inflater 
=((Activity)context).getLayoutInflater();
            row = inflater.inflate(layoutResourceId, parent, false);

            holder = new ItemsHolder();
            holder.imgItem = 
((ImageView)row.findViewById(R.id.tvImageValue));
            holder.txtCategory = 
(TextView)row.findViewById(R.id.tvCategoryValue);
            holder.txtDescription = 
(TextView)row.findViewById(R.id.tvDescriptionValue);
            holder.txtOwner = (TextView)row.findViewById(R.id.tvOwnerValue);
            holder.txtQty = 
(TextView)row.findViewById(R.id.tvQuantityValue);
            row.setTag(holder);
        }
        else
        {
            holder = (ItemsHolder)row.getTag();
        }

        InventoryItem item = items[position];
        holder.txtQty.setText(item.Count);
        holder.txtDescription.setText(item.Description);
        holder.txtCategory.setText(item.Category);

        Picasso.with(context)
                .load(item.Image)
                .into(holder.imgItem);

        holder.txtOwner.setText(item.Owner);
        return row;
    }

    static class ItemsHolder
    {
        ImageView imgItem;
        TextView txtCategory;
        TextView txtDescription;
        TextView txtOwner;
        TextView txtQty;
    }
}

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to