listView.setOnScrollListener(new OnScrollListener() {
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
if(loading){
//if trying to loading
if(totalItemCount > previousTotal){
loading = false;
previousTotal = totalItemCount;
}
}
if(!loading && ((totalItemCount - visibleItemCount) <= (firstVisibleItem + visibleThreshold))){
limit=limit+10;
AlertSearchAsync task1=new AlertSearchAsync();
String url="http://www.jobdiagnosis.com/fjobsrchservise.php?keyword="+
str_descAlert+
"&location="+str_locAlert+
"&limit="+limit;
url=url.replace(" ", "%20");
//Toast.makeText(getApplicationContext(),"Limit"+limit, Toast.LENGTH_LONG).show();
task1.execute(url);
}
});
first time asyn class call perfect and after that when scroll one and two item then call asyn class and updated listview and list view selected at top