-1

如何利用电流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));
}
4

1 回答 1

0

你似乎想念的是:

将您的适配器声明为变量并调用:

adapter.notifyDataSetChanged();
于 2012-08-15T12:54:40.427 回答