androidlistviewimageviewandroid-query

Android Query ListView image loading


Ive included my listview adapter's code below all works fine except the image isnt loaded from the url. What might be the case. I'm using the Android Query library for loading images.

  public Onadapter(Context context,String[] id,String[] label,String[] title,String[] image,String[] hrs,String[] posted_date)
    {
        this.context=context;
        this.id = id;
        this.label = label;
        this.title = title;
        this.image = image;
        this.hrs = hrs;
        this.posted_date=posted_date;


    }

    private class ViewHolder{
        ImageView img;
        TextView id;
        TextView label;
        TextView title;
        TextView hrs;
        TextView posted_date;

    }
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;

        LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.whatslist, null);
            holder = new ViewHolder();
            holder.id=(TextView) convertView.findViewById(R.id.whats_id);
            holder.img = (ImageView) convertView.findViewById(R.id.thumb1);
            holder.label= (TextView) convertView.findViewById(R.id.label);
            holder.title = (TextView) convertView.findViewById(R.id.artist_e_desc);
            holder.hrs = (TextView) convertView.findViewById(R.id.hrs);
            holder.posted_date = (TextView) convertView.findViewById(R.id.date);

            convertView.setTag(holder);
        }
        else {
            holder = (ViewHolder) convertView.getTag();
        }

        holder.id.setText(id[position]);
        holder.label.setText(label[position]);
        holder.title.setText(title[position]);
        holder.hrs.setText(hrs[position]);
        holder.posted_date.setText(posted_date[position]);
        imgaq = new AQuery(convertView);
        imgaq.id(holder.img).image(image[position], true, true, 0, 0, null, AQuery.FADE_IN_NETWORK, 1.0f);
        return convertView;
    }


    @Override
        public int getCount() {
            // TODO Auto-generated method stub
            return image.length;
        }


        @Override
        public long getItemId(int position) {
            // TODO Auto-generated method stub
            return position;
        }


        @Override
        public Object getItem(int position) {
            // TODO Auto-generated method stub
            return null;
        }




}

Solution

  • Turns out i was incorrectly referencing the xml resource for imageview.Silly me :D