我正在使用自定义ArrayList
和自定义ListView
开发应用,问题是它只能通过textview2对象进行过滤。我需要通过textview1和textview2过滤至少。
自定义ArrayList
包含:
public class favdat {
public String prece,termins,veic,links;
}
和我的ArrayAdapter:
private class MyAdapter extends ArrayAdapter<String>
{
public MyAdapter(Context context, int resource, int textViewResourceId,List<String> at)
{
super(context, resource, textViewResourceId, at);
// TODO Auto-generated constructor stub
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View row = inflater.inflate(R.layout.customlv, parent,false);
TextView tv1 = (TextView) row.findViewById(R.id.textView1);
TextView tv2 = (TextView) row.findViewById(R.id.textView2);
ImageView iv2 = (ImageView) row.findViewById(R.id.imageView1);
iv2.setClickable(true);
tv1.setText(da.get(position).prece);
tv1.setTextColor(Color.RED);
tv2.setTextColor(Color.YELLOW);
tv2.setText(da.get(position).termins);
data7 = new favdat();
data7.links = da.get(position).links;
data7.prece = da.get(position).prece;
data7.termins = da.get(position).termins;
data7.veic =
da.get(position).veic;
return row;
}
}
我正在使用文本观察器来过滤ListView
内容。但它仅按TextView2
过滤
所以问题是如何过滤我的自定义列表或如何根据我的需求编写过滤器?