title: Endless Listview with current Async Task
body: <p>I have had a good look at CWAC Endless adapter and a couple of others that do the same thing, but I cannot work out how to apply them to my current method of retrieving data, which populates 2 rows and a listview. Currently the data is retrieved via httpget in an ASync background task.  The url is altered slightly to get each subsequent page (page=1.html, page=2.html etc).</p>
  
  <p>I would like page 2 to load and append to the end of page 1 when the end is reached - I guess it is possible using CWACs method but I cannot work out how. Below is my code, help much appreciated.</p>
  
  <p>My current system works absolutely fine for displaying a single page - but I would like the endless list loading.</p>
  
  <pre><code>private class MyTask extends AsyncTask&lt;Void, Void, Void&gt; {  
  
  
  
          private ProgressDialog progressDialog;
          protected void onPreExecute() {
                 {progressDialog = ProgressDialog.show(TwitterPage.this,
                                    "", "Loading. Please wait...", true);}
  
          }
  
  
          @Override
          protected Void doInBackground(Void... arg0) {
  
              SharedPreferences myPrefs = getPreferences(MODE_PRIVATE);
                  try {   
  
                      String twitPlayers = getString(R.string.twit_players);
                      String twitClub = getString(R.string.twit_club);
                      String twitAndr = getString(R.string.twit_andr);
                      String twitMentions = getString(R.string.twit_mentions);
                      HttpClient hc;
                      HttpGet get;
                      HttpResponse rp;
                      if (myPrefs.getInt("FILTER_INT", 1) == 1){
                          hc = new DefaultHttpClient();
                          get = new
                          //All
                          HttpGet("http://search.twitter.com/search.json?q=" + twitMentions + "+OR+" + twitAndr + "+OR+from" + twitPlayers + "+OR+from" + twitClub + "&amp;result_type=recent&amp;rpp=15&amp;page="+currentpage);
                          rp = hc.execute(get);}
                      else if (myPrefs.getInt("FILTER_INT", 1) == 2){
                          hc = new DefaultHttpClient();
                          get = new
  
           ........LOADS MORE IF STATEMENTS REMOVED AS NOT RELEVANT............
  
  
                          rp = hc.execute(get);}
  
                      if(rp.getStatusLine().getStatusCode() == HttpStatus.SC_OK)
                          {
                                  String result = EntityUtils.toString(rp.getEntity());
                                  JSONObject root = new JSONObject(result);
                                  JSONArray sessions = root.getJSONArray("results");
                                  for (int i = 0; i &lt; sessions.length(); i++) {
                                          JSONObject session = sessions.getJSONObject(i);
                                  Tweet tweet = new Tweet();
                                           tweet.content = session.getString("text");
                                           tweet.author = session.getString("from_user");
                                           tweets.add(tweet);
                                  }
                         }
                 } catch (Exception e) {
                         Log.e("TwitterFeedActivity", "Error loading JSON", e);
  
                 }
  
  
  
  
                 return null;
        }
        @Override
        protected void onPostExecute(Void result) {
        {  progressDialog.dismiss();}
  
  
  
            //setadapter
            setListAdapter(new TweetListAdaptor(
                    TwitterPage.this, R.layout.list_item, tweets));
  
  
       }
      }
  
  
  
       private class TweetListAdaptor extends ArrayAdapter&lt;Tweet&gt; {
        private ArrayList&lt;Tweet&gt; tweets;
        public TweetListAdaptor(Context context,
        int textViewResourceId,
        ArrayList&lt;Tweet&gt; items) {
        super(context, textViewResourceId, items);
        this.tweets = items;
        }
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
                View v = convertView;
                if (v == null) {
                        LayoutInflater vi = (LayoutInflater)
        getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                        v = vi.inflate(R.layout.list_item, null);
                }
                Tweet o = tweets.get(position);
                TextView tt = (TextView) v.findViewById(R.id.toptext);
                TextView bt = (TextView) v.findViewById(R.id.bottomtext);
                tt.setText(o.content);
                bt.setText(o.author);
                return v;
  
  
  
        }
  
        }
  </code></pre>