Skip to main content

"Million Contacts" Problem - List Cyclic Scrolling

2 replies [Last post]
rfm8
Offline
Joined: 2009-03-12
Points: 0

Hello all!
I've tried to make a list using this tutorial:
http://lwuit.blogspot.com/2008/08/model-mvc-million-contacts-march.html

My problem is that I cannot select elements of the list, and that the list is cyclic. I don't want the list be cyclic...
This is my code that describes the properties of the list (in my case it is questions renderer):

l.setListCellRenderer(new QuestionsRenderer());
l.setFixedSelection(List.FIXED_NONE_CYCLIC);
f.setLayout(new BorderLayout());
f.addComponent(BorderLayout.CENTER, l);

What should I do?

Many Thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rfm8
Offline
Joined: 2009-03-12
Points: 0

Hi all!
The problem were fixed!

The solution is:
1. l.setFixedSelection(List.FIXED_NONE);
2. In this code:
List l = new List(new ListModel() {
private int selection;
public Object getItemAt(int index) {
return contactArray[index % contactArray.length];
}

public int getSize() {
return 1000000;
}

public int getSelectedIndex() {
return selection;
}

public void setSelectedIndex(int index) {
selection = index;
}

public void addDataChangedListener(DataChangedListener l) {
}

public void removeDataChangedListener(DataChangedListener l) {
}

public void addSelectionListener(SelectionListener l) {
}

public void removeSelectionListener(SelectionListener l) {
}

public void addItem(Object item) {
}

public void removeItem(int index) {
}
});
you should change the getSize number to contactArray.length

anmc
Offline
Joined: 2008-10-21
Points: 0

Try:
l.setFixedSelection(List.FIXED_NONE);