2012-08-15 2 views
-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)); 
} 

답변

0

당신이 그리워하는 것 모두는 다음과 같습니다

변수로 어댑터를 선언하고 호출

adapter.notifyDataSetChanged(); 
+0

당신이 날 예 보여줄 수 있습니까? 나는 아직도 당신이 의미하는 것을 얻지 못합니까? –

관련 문제