Reputation: 921
I have designed a lwuit form with a textfield and a list bottom of it. Now, I want following functionality:
every time user changes a textfield content, list should be refreshed (like autocomlplete feature) but I don't know how to refresh a list? for creating a list I have used following code:
choicelists = createList(urbanplacechoiceGroup, List.VERTICAL, new PlaceRenderer());
and for listening to texhfield changes:
Urbanareas_textpublic.addDataChangeListener(new DataChangedListener() {
public void dataChanged(int type, int index) {
System.out.println("text content: " + Urbanareas_textpublic.getText());
populateurbanplacechoiceGroup();
}
});
urbanplacechoiceGroup is used to populate urbanplacechoiceGroup which its content used for choicelists.
I found this function and it does updating a list:
choicelists.setRenderer(new PlaceRenderer());
is it a standard way to updating list? what happened to PlaceRenderer objects which was created before? thanks.
Upvotes: 0
Views: 380
Reputation: 52770
See this post http://codenameone.blogspot.com/2008/06/lightweight-text-input-in-lwuit.html
It covers filtering a list dynamically, basically what you are looking for is a list model which abstracts the data of the list.
Upvotes: 1
Reputation: 209
You can use in list that work with ListCellRenderer.
This is dinamic list that use to dispalying data list.In addtional this list save up use in memory ,because he don't create a list but use data only to display.
Upvotes: 1