我有一个带有 SimpleCursorAdapter 的列表,这个列表是由一个数组列表组成的,问题是我只想在列表中添加具有“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;
}
}