Skip to content

Instantly share code, notes, and snippets.

@codenameone
Created September 2, 2013 10:01
Show Gist options
  • Save codenameone/6411227 to your computer and use it in GitHub Desktop.
Save codenameone/6411227 to your computer and use it in GitHub Desktop.
final Form test = new Form("Infinite");
test.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
InfiniteScrollAdapter.createInfiniteScroll(test.getContentPane(), new Runnable() {
private int counter = 1;
public void run() {
// simulate network latency
Display.getInstance().invokeAndBlock(new Runnable() {
public void run() {
try {
Thread.sleep(2000);
} catch(InterruptedException e) {}
}
});
Component[] buttons = new Component[20];
for(int iter = 0 ; iter < buttons.length ; iter++) {
buttons[iter] = new Button("Button: " + counter);
counter++;
}
InfiniteScrollAdapter.addMoreComponents(test.getContentPane(), buttons, true);
}
});
test.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment