リストビューとそのアダプタがグローバル変数として格納されています。私はListActivity
を拡張してリストを作成していません。次のように私のコードは次のとおりです。リストの検索がAndroidで機能していない
public void onCreate(Bundle...) {
mListView = (ListView) findViewById(R.id.listview1);
//setting my custom array adapter...works fine.
//also my custom adapter implements Filterable interface
mListView.setAdapter(...)
mListView.setTextFilterEnabled(true);
//My edit text where I enter my query
mSearchEditText = (EditText) findViewById(R.id.searchEditText);
mSearchEditText.addTextChangedLIstener(myListener);
}
private TextWatcher myListener = new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (s == null || s.length() == 0) {
mListView.clearTextFilter();
}
else {
mListView.setFilterText(s.toString());
}
}
...
...
}
私の問題は、私はエディットテキストで私の文字列を入力すると、それは私が私のリストで利用可能な検索項目(数字のみ)の何を修正ではなく、項目自体は与えていないです。例えば
私のリストはなくBB項目AA、BB、CC、DD、FF、EE、EEだから私はEEを検索する場合
は、私の結果はAAになりますが、持っている場合ee、ee。 ccを検索すると、フィルタリストにaaと表示されます。
誰もが私にこれを助けることができますか?
私はそれに取り組んでいます。一度完了するとあなたに戻ってきます。 – AndroDev
ビンゴ...それは働いた。ありがとう。 – AndroDev
あなたは大歓迎です:) – Chronos