【发布时间】:2023-04-08 02:53:01
【问题描述】:
我正在显示联系人列表。除了该设备有 1620 个联系人之外一切都很好,因此列表滚动非常缓慢,甚至有时会挂起。
请帮帮我。
我尝试对ConvertView!=null 使用检入getView 方法,但它总是多次膨胀同一个视图。提前谢谢..
getView 方法的代码:-
if(ConvertView==null)
{ view= mInflater.inflate(R.layout.facebookfriend, null);
TextView name=(TextView)view.findViewById(R.id.textView1);
ImageView image=(ImageView)view.findViewById(R.id.imageView1);
name.setText(mlist.get(position).get("name"));
String Id=mlist.get(position).get("contactId");
Log.e("Id",""+Id);
CheckBox chkbox= (CheckBox)view.findViewById(R.id.checkBox1);
chkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(
CompoundButton buttonView, boolean isChecked) {
isSelected.set(position, isChecked);
}
});
String photoid=mlist.get(position).get("photoId");
Log.e("photoid",""+photoid);
if(mlist.get(position).get("photoId")!=null){
Log.e("photoid",""+"photoid");
image.setImageBitmap(loadContactPhoto(Id, mlist.get(position).get("photoId")));
}
}
}
【问题讨论】:
标签: android android-listview contacts adapter