2012-12-18 57 views
0

我有一个SimpleCursorAdapter的列表,这个列表是用ArrayList创建的,问题是我想在列表中只添加来自数组的具有“persoane.proprietar ==”的数组的值“这是我的代码细节android简单游标适配器

private class ImageAndTextAdapter extends SimpleCursorAdapter { 
    private Context adContext; 

    public int getCount() { 
     persNu = persPropNu(); 
     return persNu; 
    } 

    public ImageAndTextAdapter(Context context, int layout, Cursor c, 
      String[] from, int[] to) { 
     super(context, layout, c, from, to); 
     this.adContext = context; 
    } 

    public View getView(int pos, View inView, ViewGroup parent) { 
     View v = inView; 
     if (v == null) { 
      LayoutInflater inflater = (LayoutInflater) adContext 
        .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
      v = inflater.inflate(R.layout.element_lista_items, null); 
     } 
if (GetObiecte.persoane.get(pos).proprietar.equals("no"))//if put this line in the list will be a blank line if the propriety isn't no,and I don't need it 
     ((TextView) v.findViewById(R.id.textListTopElem)).setText(GetObiecte.persoane.get (pos).nume); 
     ((TextView) v.findViewById(R.id.textListElem)).setText(GetObiecte.persoane.get (pos).judet); 
     if (GetObiecte.persoane.get(pos).tipPersoana.equals("fizica")){((ImageView) v.findViewById(R.id.imgListElem)).setImageResource(R.drawable.icon_foto_person);} 
     else {((ImageView) v.findViewById(R.id.imgListElem)).setImageResource(R.drawable.icon_foto_person_pj);} 
     return v; 
    } 
} 

回答

0

如果这个值没有变化动态则仅发送相关项目的适配器。

如果是动态改变,你可以使用过滤器就像解释in this question