please be specific during using and dealing with the image loader class. If possible, don't create more instance of the same class. Instead of use the same instance in different way.
See below adapter class and try to integrate same in your case. which will help you.
private class OrderAdapter extends ArrayAdapter<User> {
private ArrayList<User> items;
Activity a;
public ImageLoader imageLoader;
public OrderAdapter(Context context, int textViewResourceId,ArrayList<User> items) {
super(context, textViewResourceId, items);
this.items = items;
// extra
/*if (Utility.model == null) {
Utility.model = new FriendsGetProfilePics();
}
Utility.model.setListener(this);*/
}
/*@Override
public boolean isEmpty() {
// TODO Auto-generated method stub
super.isEmpty();
return false;
}*/
@Override
public View getView(final int position, View convertView,ViewGroup parent) {
ViewHolder holder;
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.add_buddies_row_new, null);
holder = new ViewHolder();
imageLoader = new ImageLoader(NotificationsActivity.this);
//--------------
//---------------------------------------------------------------------
// for head to head
holder.userName = (TextView) v.findViewById(R.id.txtName);
holder.userPic = (ImageView) v.findViewById(R.id.imgUserPic);
holder.userCity = (TextView) v.findViewById(R.id.txtCity);
holder.userState = (TextView) v.findViewById(R.id.txtstate);
holder.userCountry = (TextView) v.findViewById(R.id.txtContry);
//---------------------------------------------------------------------
v.setTag(holder);
}else{
holder=(ViewHolder)v.getTag();
}
final User o = items.get(position);
holder = (ViewHolder) v.getTag();
if (o != null) {
holder.userName.setText(o.getUserName());
holder.userCity.setText(o.getUserCity()+", ");
holder.userState.setText(o.getUserState()+", ");
holder.userCountry.setText(o.getUserCountry());
System.out.println("PIC: "+o.getUserPic());
holder.userPic.setTag(o.getUserPic());
imageLoader.DisplayImage(o.getUserPic(), a, holder.userPic);
}
return v;
}
}
class ViewHolder {
TextView userName ;
TextView userCity;
TextView userState;
TextView userCountry;
ImageView userPic ;
}
Comment me for any dought.
Note: YOU HAVE TO DO SOME CHANGES IN ABOVE CODE AS PER YOUR REQUIREMENT.
If your issue not solve with this then let me know.
It can also happend if you are getting null data so please be confirm with getting data.