0

データベースからすべてのメンバーデータを取得してリストビューに表示しようとしていますが、機能しています。

今、私は特定のメンバーを検索しようとしていますが、(logcat にログインした) レコードを取得できましたが、それに応じてリストビューが更新されません。

これは、検索されたレコードを取得するために使用したリスト ビュー コードです。

            SimpleAdapter simpleAdapter = new SimpleAdapter(Search.this, productsList, R.layout.list_item, new String[] {TAG_COMPANY},
                    new int[] { R.id.name});
            lv = (ListView) findViewById(R.id.lst_name);
            lv.setAdapter(simpleAdapter);
4

2 に答える 2

0

これらのリンクを確認してください。通常、それは前方に緊張しています。Textwatcher を作成し、アダプタを変更されたテキストにバインドするだけです。または、フィルタリング可能なインターフェースを実装して、android:textFilterEnabled が true であると言うことができます。

リンク 1

リンク 2

于 2012-11-09T03:06:58.047 に答える
0

This is because. you need to let the ListView know that a change in your data has occurred. To notify the ListView about the change, you need to call:

simpleAdapter.notifyDataSetChanged();

If for some reason it didn't work, you can also reassign the adapter of your ListView:

simpleAdapter = new SimpleAdapter(...);
lv.setAdapter(yourAdapter);
simpleAdapter.notifyDataSetChanged();
于 2012-11-09T05:48:09.530 に答える