私はandroidimageloader.comを使用しており、それを使用するデモやアプリとは異なり、画像がリストに読み込まれるときに少しちらつきが発生します。アプリケーションクラスにimageLoaderがありますが、ちらつく理由がわかりません。画像はユーザー向けのFacebookプロフィール写真です。これを引き起こしているのは何ですか?これが私のアダプターです:
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;
}
}