I have a custom object list field with implemented scrolling routine.
public int moveFocus(int amount, int status, int time) {
invalidate(getSelectedIndex());
int unused = super.moveFocus(amount, status, time);
return Math.abs(unused) + 1;
}
public boolean navigationMovement(int dx, int dy, int status, int time) {
if (dy > 0) {
if (selectedIndex < getSize() - 1) {
setSelectedIndex(selectedIndex + 1);
}
} else if (dy < 0) {
if (selectedIndex > 0) {
setSelectedIndex(selectedIndex - 1);
}
}
return true;
}
Scrolling works fine when I scroll with trackwheel, but gets broken when app is launched on a device with trackball. I figured out that problem lays in framework method moveFocus which is not called at all when I scroll with trackball.