Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should set onScrollListener in your list and keep a track of the visibility of the items and the offset. I show you an example here:</p> <pre><code>// Adapter for the custom list adapter = new Adapter(this, activityList); setListAdapter(adapter); registerForContextMenu(getListView()); getListView().setOnScrollListener(new OnScrollListener(){ public void onScroll(AbsListView lw, final int firstVisibleItem, final int visibleItemCount, final int totalItemCount) { switch(lw.getId()) { case android.R.id.list: // Make your calculation stuff here. You have all your // needed info from the parameters of this function. // Sample calculation to determine if the last // item is fully visible. final int lastItem = firstVisibleItem + visibleItemCount; if(lastItem == totalItemCount) { // Last item is fully visible. Log.i("a", "last item fully visible..."); try { if(offset &gt; 0){ int newLimit; int oldOffset = offset; if(offset &gt;= limit){ newLimit = limit; offset = offset - limit; } else{ newLimit = length; offset = 0; } for (int i=0; i &lt; newLimit; i++) { JSONObject item = jFeed.getJSONObject(i + length - oldOffset); // Pulling items from the array // Get list info String sInfo = item.getString(TAG_INFO); Log.i(MainActivity.class.getName(), "Info: " + sInfo); // Populate the dynamic custom list HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put(KEY_INFO, sInfo); activityList.add(map); } adapter.notifyDataSetChanged(); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } public void onScrollStateChanged(AbsListView view, int scrollState) { // TODO Auto-generated method stub if(scrollState == 0) Log.i("a", "scrolling stopped..."); } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload