Skip to main content

How to clear elements of List

1 reply [Last post]
Joined: 2008-06-26

hi everbody

i m using LWUIT tool for develop mobile application.but i m unable to clear all elements of List.
you have nay solution for this plz reply me soon

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-15

FYI... the source for LWUIT is available at:

There seems to be 2 ways of clearing all elements from the list.
1) get the model, from the model get the size, and then remove the item at an index (size) number of times.
ListModel model = uiList.getModel();
for(int i=model.getSize(); i>=0; --i)

2) replace the model with an empty one.

ListModel model = new YourModel();

Next time try reading the source, it is faster than waiting for someone else to read it for you.