ExpandableListView
を使用してAndroidでデータをフィルタリングしたいのですが、を実装EditText
する必要があることを確認しますが、フィルターデータに関する知識が不足しているため、この実装を実行する方法がわかりません。私のアダプターの構造は次のとおりです。adapter
Filtering
public class ExpandableListAdapter extends
BaseExpandableListAdapter /*implements Filterable*/ {
private final Context myContext;
private String[] arrayTopics;
private String[][] arraySubTopics;
public PrimeirosSOSExpandableListAdapter(Context context) {
this.myContext = context;
}
public ExpandableListAdapter(Context context,
String[] arrayTopics, String[][] arraySubTopics) {
this.myContext = context;
this.arrayTopics = arrayTopics;
this.arraySubTopics = arraySubTopics;
}
public Object getChild(int groupPosition, int childPosition) {
return null;
}
public long getChildId(int groupPosition, int childPosition) {
return 0;
}
public View getChildView(int groupPosition, int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) myContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.child_layout,
null);
}
TextView tv = (TextView) convertView.findViewById(R.id.tvChild);
tv.setText(arraySubTopics[groupPosition][childPosition]);
return convertView;
}
public int getChildrenCount(int groupPosition) {
return arraySubTopics[groupPosition].length;
}
public Object getGroup(int groupPosition) {
return null;
}
public int getGroupCount() {
return arrayTopics.length;
}
public long getGroupId(int groupPosition) {
return 0;
}
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) myContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.group_layout,
null);
}
TextView tv = (TextView) convertView.findViewById(R.id.tvGroup);
tv.setText(arrayTopics[groupPosition]);
return convertView;
}
public boolean hasStableIds() {
return false;
}
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
}