Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/217.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android getView中的小故障_Android_Android Listview_Contacts_Adapter - Fatal编程技术网

Android getView中的小故障

Android getView中的小故障,android,android-listview,contacts,adapter,Android,Android Listview,Contacts,Adapter,我正在显示联系人列表。除了设备有1620个联系人之外,其他都很好,所以列表滚动非常慢,有时甚至会挂起 请帮帮我 我尝试为ConvertView使用check-in-getView方法=空但它总是多次膨胀同一视图。提前谢谢 getView方法的我的代码:- if(ConvertView==null) { view= mInflater.inflate(R.layout.facebookfriend, null); TextView name=(T

我正在显示联系人列表。除了设备有1620个联系人之外,其他都很好,所以列表滚动非常慢,有时甚至会挂起

请帮帮我

我尝试为
ConvertView使用check-in-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")));
            }
        }
    }

使用
ViewHolder模式
可以有效地
ListView
。这里有一个详细的教程。 尝试在您的应用程序中实现此功能,并告知我们是否有帮助


使用
ViewHolder模式
可以有效地
ListView
。这里有一个详细的教程。 尝试在您的应用程序中实现此功能,并告知我们是否有帮助


您可以使listview根据需求动态加载数据,请参见,您还应该使用它来提高效率,请参见。

您可以使listview根据需求动态加载数据,请参见,您还应该使用它来提高效率,请参见。

如果(ConvertView==null){holder=new ViewHolder();ConvertView=mInflater.inflate(R.layout.facebookfriend,null);holder.name=(TextView)ConvertView.findViewById(R.id.textView1);holder.imageView=imageView)ConvertView.findViewById(R.id.imageView1);holder.chkbox=(复选框)ConvertView.findViewById(R.checkBox1);ConvertView.setTag(holder)}其他{holder=(ViewHolder)ConvertView.getTag();}holder.name.setText(mlist.get(position).get(“name”).toString();holder.chkbox.setOnCheckedChangeListener(新建OnCheckedChangeListener(){@Override public void onCheckedChanged(CompoundButton Button视图,布尔值isChecked){isSelected.set(position,isChecked);Log.e(“position”+position,“+isChecked”);})字符串Id=mlist.get(position.get(“Contactid”).toString();Log.e(“Id”),“--------------”+Id);if(mlist.get(position.get(“Photoid”)!=null){Log.e(“Photoid”),“+”Photoid”);holder.imageView.setImageBitmap(loadContactPhoto(Id,mlist.get(position.get(“Photoid”);}抱歉,我又不知道如何编写代码了,我把它放在三个注释中请帮助!!@Kabir121请将代码作为另一个问题发布,这样我和其他人可以帮助你。如果(ConvertView==null){holder=new ViewHolder();ConvertView=mInflater.flate(R.layout.facebookfriend,null);holder.name=(TextView)ConvertView.findviewbyd(R.id.textView1);holder.imageView=imageView)ConvertView.findViewById(R.id.imageView1);holder.chkbox=(复选框)ConvertView.findViewById(R.id.checkBox1);ConvertView.setTag(holder);}else{holder=(ViewHolder)ConvertView.getTag();}holder.name.setText(mlist.get(position).get(“name”).toString();holder.chkbox.SetOnCheckdChange监听器(新OnCheckedChangeListener(){@Override public void onCheckedChanged(CompoundButton Button视图,boolean isChecked){isSelected.set(position,isChecked);Log.e(“position”;“+isChecked”);}};String Id=mlist.get(position).get(“Contactid”).toString();Log.e(“Id”,“--------------”+Id);if(mlist.get(position).get(“Photoid”)!=null){Log.e(“photoid”,“+”photoid”);holder.imageView.setImageBitmap(loadContactPhoto(Id,mlist.get(position.get(“photoid”));}对不起,我又不知道如何编写代码了,我把它放在三个注释中,请帮助!!@Kabir121请将代码作为另一个问题发布,以便我和其他人可以帮助你。