onScroll not working properly
<pre><code>@Override
public void onScroll(AbsListView view, int firstVisibleItem,
        int visibleItemCount, int totalItemCount) {
    // TODO Auto-generated method stub
    Toast.makeText(ViewPage.this, "In" , 1).show();
     if (loading) 
     {
         if (totalItemCount &gt; previousTotal) 
         {
            loading = false;
            previousTotal = totalItemCount;
            currentPage++;
         }
     }
     if (!loading &amp;&amp; (totalItemCount - visibleItemCount) &lt;= (firstVisibleItem + visibleThreshold)) 
     { 


            for(int i=0;i&lt;5;i++)
            {
                filename[i] = contactcursor.getString(contact_column_index);
                Toast.makeText(ViewPage.this, filename[i] +" "+ contactcursor.getString(contact_column_index) , 1).show();
                contactcursor.moveToNext();

            }


            arr_ad = new ArrayAdapter&lt;String&gt;(ViewPage.this, android.R.layout.simple_list_item_1, filename);


            setListAdapter(arr_ad);
            // I load the next page of gigs using a background task,
            // but you can call any function here.
           // new LoadGigsTask().execute(currentPage + 1);
            loading = true;
            Toast.makeText(ViewPage.this,totalItemCount+" "+visibleItemCount+" "+firstVisibleItem+" "+visibleThreshold+" ", 1).show();
     }
}
</code></pre>

<p>this is part of the code, where the onScroll should have worked only when listview was scrolled down, but it works automatically when activity starts as the toast within it is printed. thanx in advance.</p>
