如何利用电流ListView
与我的搜索集成?
/**
* Updating parsed JSON data into ListView
* */
ListAdapter adapter = new SimpleAdapter(
AllEventsActivity.this, eventsList, R.layout.list_item, new String[] { TAG_EID, _NAME},
new int[] { R.id.eid, R.id.ename });
//updating listview
setListAdapter(adapter);
现在如何使用ListView
集成到下面的搜索代码中?
public void onTextChanged(CharSequence s, int start, int before, int count)
{
textlength = et.getText().length();
array_sort.clear();
for (int i = 0; i < listview_array.length; i++) {
if (textlength <= listview_array[i].length()) {
if(et.getText().toString().equalsIgnoreCase((String)
listview_array[i].subSequence(0, textlength)))
{
array_sort.add(listview_array[i]);
}
}
}
lv.setAdapter(new ArrayAdapter<String>(ListViewSearchExample.this,android.R.layout.simple_list_item_1, array_sort));
}