I am developing an application which consists on scroll-change-listener,Here is my problem, I am getting the Number of items for the server.Until here every thing works fine to me.
1.IF i am showing the 10 values in the list-view,that 10 values only should stream.
2.When Scroll state is changed the reaming item should hit server.
3.Below is my code .
@Override
public void onScroll(AbsListView view, int firstVisibleItem,int visibleItemCount, int totalItemCount) {
if (visibleItemCount < 1)
return;
streaming.clear();
int firstPoisitionValue = symbolList.getFirstVisiblePosition();
int lastPositionValue = symbolList.getLastVisiblePosition();
WatchListData row;
String symbol;
for (int i = firstPoisitionValue; i <= lastPositionValue; i++) {
row = model.get(i);
symbol=row.getSymbol();
Log.w("Hello Android", "Symbol Value ::>"+symbol);
streaming.add(symbol);
}
if (streamFlag) {
System.out.println("calling the request");
streamingRequest("quote", streamingSymbols);
streamFlag = false;
}
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
pauseStreaming();
if(scrollState == SCROLL_STATE_IDLE){
streamingRequest("quote", streamingSymbols);
}
Thanks, Nikhilreddy.