0
Guys, I have a floating button in my view that prints all the items on my listview. What happens is that when I click on the floating button it takes a picture of the first 3 items and does not take the rest, but at the end it updates the listview for the next items. It looks like the code to take the print is faster than the listview update. When I click the floating button the screenshot function is called.
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE){
printScreen();
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
public void screenShot (){
if (list.getFirstVisiblePosition() == 0) {
printScreen();
} else {
list.smoothScrollToPosition(0);
}
}
public void printScreen(){
int lastPosition = list.getLastVisiblePosition();
int j = list.getFirstVisiblePosition();
for (int i = j; i < lastPosition; i++){
if (list.getChildAt(i) != null && list.getChildAt(i).isEnabled()) {
JUtil.saveScreenShot(list.getChildAt(j), "operadora" + j + ".png");
}
}
list.setSelection(lastPosition);
}
That line
JUtil.saveScreenShot(list.getChildAt(j), "operadora" + j + ".png");
isn’t it a bug? Shouldn’t it bei
in place ofj
being like thisJUtil.saveScreenShot(list.getChildAt(i), "operadora" + i + ".png");
?– Piovezan
Yes, I was wrong, but it didn’t solve the problem either. But I already did, I’ll post as it turned out
– Eduardo Bonfa