Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: problem with endless adapter
    text
    copied!<p>I'm trying to use "http://github.com/commonsguy/cwac-endless" to implement pagination for my list views.</p> <p>I'm getting the first page results correctly, when I scrolled down to the bottom of the 1st page, i'm seeing the spinning wheel but im not getting any results.</p> <p>I noticed from the LogCat that, getPendingView(), cacheInBackground(), appendCachedData() and MyCustomAdapter's getView() are getting called infinately.</p> <p>Can anybody plz help.</p> <p>Thanks, nehatha.</p> <p>Here is my code snippet:</p> <pre><code>Activity{ onCreate() { myList = new ArrayList&lt;Item&gt;(); setListAdapter(new DemoAdapter(myList)); nextLink = "service_url"; //for first page results (say 1-25) } final Handler handler = new Handler() { public void handleMessage(final Message msg) { // updateList(jsonResponse); } }; updateList(String jsonString) { //parse json //add to `myList` //update `nextLink`, if there is next page available } class DemoAdapter extends EndlessAdapter { private RotateAnimation rotate=null; DemoAdapter(List&lt;Item&gt; list) { super(new MyCustomAdapter(LatestUpdatesList.this, R.layout.latest_update_item, list)); //rotate code } @Override protected boolean cacheInBackground() { if(nextLink != null &amp;&amp; nextLink.length() &gt; 0){ HttpHandler httpHandler = new HttpHandler(nextLink, "GET", handler); Thread latestUpdatesThread = new Thread(httpHandler); latestUpdatesThread.start(); return true; } return false; } @Override protected void appendCachedData() { MyCustomAdapter adapter = (MyCustomAdapter)getWrappedAdapter(); adapter.setList(myList); } } //DemoAdapter } //Activitiy </code></pre>
 

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