0

I am using androidimageloader.com and get a good bit of flicker as images load into the list, much unlike the demo and apps that use it. I have the imageLoader in the application class, and don't get why it flickers. The images are Facebook profile pictures for users. What would be causing this? Here is my adapter:

public class FriendAdapter extends BaseAdapter {
    private Typeface tf;
    LayoutInflater inflater;
    private String[] nameEvents;
    private String[] urls;
    private ArrayList<Friend> friends;
    ImageManager imageManager;
    ImageTagFactory imageTagFactory;

    public FriendAdapter(Activity activity, ArrayList<Friend> friends) {
        this.friends = friends;
        setData(this.friends);
        tf = Typeface.createFromAsset(activity.getAssets(),
                "fonts/Roboto-Condensed.ttf");
        inflater = (LayoutInflater) activity
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        imageManager = BuzzbabaApplication.getImageLoader();
        imageTagFactory = new ImageTagFactory(activity, R.drawable.no_pic_icon);
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        FriendView fView;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.friend_layout, null);
            fView = new FriendView();
            fView.name = (TextView) convertView.findViewById(R.id.friendName);
            fView.name.setTypeface(tf);
            fView.pic = (ImageView) convertView.findViewById(R.id.profilePic);
            convertView.setTag(fView);
        } else {
            fView = (FriendView) convertView.getTag();
        }
        fView.name.setText(nameEvents[position]);
        // HomeScreen.imageLoader.DisplayImage(urls[position], fView.pic);
        ((ImageView) fView.pic).setTag(imageTagFactory.build(urls[position]));
        imageManager.getLoader().load(fView.pic);
        return convertView;
    }

    public void setData(ArrayList<Friend> friends) {
        nameEvents = new String[friends.size()];
        urls = new String[friends.size()];
        int index = 0;
        for (Friend f : friends) {
            String pos = f.getName();
            int num = f.getNumEvents();
            if (num == 1) {
                pos = pos + "\n" + num + " event";
            } else {
                pos = pos + "\n" + num + " events";
            }
            nameEvents[index] = pos;
            urls[index] = f.getPictureURL();
            index++;
        }
    }

    static class FriendView {
        TextView name;
        ImageView pic;
    }

    public int getCount() {
        return friends.size();
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }

}
egfconnor
  • 2,637
  • 1
  • 26
  • 44
  • Once the images download and you scroll through an area of the list where they are cached, its smooth as butter, but when they are downloading this isn't the case, they flicker in and it breaks up the UI experience. – egfconnor Nov 20 '12 at 03:05
  • Hi @user1212314, I am also using the ImageLoader to load images, but getting Null pointer exception. Could you please take a look at this [link](http://stackoverflow.com/questions/14869769/image-not-loading-using-the-novoda-imageloader) and help me as to where i'm going wrong? – jasdmystery Feb 14 '13 at 09:36

0 Answers0