我有一个带有SimpleCursorAdapter的列表,这个列表是用arraylist制作的,问题是我只想在列表中添加数组中的值,这些值具有"persoane.proprietar=="no"的专有性,这是我的详细信息代码
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;
}
}
如果此值未动态更改,则仅将相关项发送到适配器。
如果它是动态更改的,您可以使用此问题中所述的过滤器