我希望过滤搜索ListView
但不存在类`getfilter()
我已经在网站上研究过应该寻求这些方法。我已阅读,但我没有得到getfilter()
谁能帮助我? (对不起,我不会说英语好,只能看懂)
public class List_bimar extends ListActivity {
TextView bimar_id;
EditText editsearch;
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sabte_bimar);
editsearch = (EditText) findViewById(R.id.btn_search);
BimarRipo repo = new BimarRipo(this);
ArrayList<HashMap<String, String>> bimartList = repo.getbimarList();
if(bimartList.size()!=0) {
ListView lv = getListView();
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
bimar_id = (TextView) view.findViewById(R.id.bimar_idd);
String bimarId = bimar_id.getText().toString();
Intent objIndent = new Intent(getApplicationContext(),Bimar_Detail.class);
objIndent.putExtra("bimar_id", Integer.parseInt( bimarId));
startActivity(objIndent);
}
});
final ListAdapter adapter = new SimpleAdapter( List_bimar.this,bimartList, R.layout.view_bimar_entry, new String[] { "id","namebimar" ,"shomaremeli" }, new int[] {bimar_idd, R.id.bimar_name});
setListAdapter(adapter);
editsearch.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
List_bimar.this.getListAdapter().
}
@Override
public void afterTextChanged(Editable editable) {
String text = editsearch.getText().toString().toLowerCase(Locale.getDefault());
}
});
}