title: Updating list in listfragment with costom adapter
body: <p>I'm using onScroll onclicklistner to update listview in my listFragment.   </p>
  
  <pre><code>public class WishboardFragment extends ListFragment implements OnScrollListener{
  
     private ProgressBar progressBar2;
     private TextView finished;
     private Context context = null;
     private ListAdapter wishAdapter = null;
     private final String TAG = "wishboard";
     private final String cachedName = "wishboard";
     JSONObject jsonObject = null;
     JSONArray jsonArray = null;
     private Menu optionsMenu;
     private Integer pageStart = 1;
     private Integer pageEnd = 15;
     private Boolean isDownloading = false;
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
      this.context = getActivity();
      return  inflater.inflate(R.layout.activity_dashboard,container,false);
  }
  
  
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
  
      String url = getWishboardUrl();
      sendRequest(url);
      setHasOptionsMenu(true);
      super.onCreate(savedInstanceState);
  }
  
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
      super.onActivityCreated(savedInstanceState);
      wishAdapter = new WishRowAdaptor(getActivity(),this.getWishboardCached());
      setListAdapter(wishAdapter);
  }
  
  
  @Override
  public void onCreateOptionsMenu(Menu menu,MenuInflater inflater) {
      this.optionsMenu = menu;
      inflater.inflate(R.menu.dashboard, menu);
      super.onCreateOptionsMenu(menu, inflater);
  }
  
  @Override
  public void onResume() {
      // TODO Auto-generated method stub
      super.onResume();
      getListView().setOnScrollListener(this);
  }
  
  public boolean onOptionsItemSelected(MenuItem item) {
      switch (item.getItemId()) {
  
      case R.id.btn_refresh:
          Common.setRefreshActionButtonState(true,optionsMenu);
          String url = getWishboardUrl();
          sendRequest(url);
      return true;
  
      }
      return super.onOptionsItemSelected(item);
  }
  
  
  
  
  public void sendRequest(String url) {
      new SendRequest().execute(url);
  }
  
  private class SendRequest extends AsyncTask&lt;String, Integer, String&gt; {
  
      protected String doInBackground(String... requestURL) {
  
          String data = "";
          HttpURLConnection httpUrlConnection = null;
  
          try {
              URL url = new URL(requestURL[0]);
              URLConnection connection = url.openConnection();
              connection.setUseCaches(true);
  
              Object response = connection.getContent();
              Log.i(TAG, "Requesting http "+requestURL[0]);               
  
              if (response instanceof Bitmap) {
              }
  
              InputStream in = new BufferedInputStream(
                      connection.getInputStream());
  
              data = Common.readStream(in);
  
          } catch (MalformedURLException exception) {
              Log.e(TAG, "MalformedURLException");
          } catch (IOException exception) {
              Log.e(TAG, "IOException");
          } finally {
              if (null != httpUrlConnection)
                  httpUrlConnection.disconnect();
          }
          return data;
  
      }
  
      protected void onPostExecute(String jsonString) {
  
          jsonObject = Common.getObjectFromJsonString(jsonString,3);
          ArrayList&lt;HashMap&lt;String, String&gt;&gt; wishList = Common.parseJson(jsonObject);
  
          if (pageEnd &gt; Constants.limit) {
              wishAdapter = new WishRowAdaptor(getActivity(),wishList);
  
          }else{
              Common.cacheResponse(context,cachedName,jsonString);
              wishAdapter = new WishRowAdaptor(getActivity(),wishList);
              setListAdapter(wishAdapter);
              Common.setRefreshActionButtonState(false, optionsMenu);
          }       
  
          isDownloading = false;
      }
  
  }
  
  
  private ArrayList&lt;HashMap&lt;String, String&gt;&gt; getWishboardCached() {
  
      String jsonString = Common.getCachedResponse(context,cachedName);
  
      try {
          jsonObject = Common.getObjectFromJsonString(jsonString,3);
          ArrayList&lt;HashMap&lt;String, String&gt;&gt; wishList = Common.parseJson(jsonObject);
          return wishList;
      } catch (Exception e) {
          // TODO: handle exception
      }
      return null;
  }   
  
  @Override
  public void onScroll(AbsListView view, int firstVisibleItem,
          int visibleItemCount, int totalItemCount) {
      if (view.getAdapter() != null
              &amp;&amp; ((firstVisibleItem + visibleItemCount) &gt;= totalItemCount) 
              &amp;&amp;          isDownloading == false) {
  
  
          pageStart = pageEnd + 1;
          pageEnd = pageStart + (Constants.limit -1);
          String url = getUrl();
          sendRequest(url);
          isDownloading = true;
      }
  }
  }
  </code></pre>
  
  <p>In the above code If use <code>setListAdapter(wishAdapter);</code> in <strong>onPostExecute()</strong> after user has reached end of list. Listview gets updated but all the preveious entries goes away. </p>
  
  <p>Here is my custom adapter </p>
  
  <pre><code>public class WishRowAdaptor extends BaseAdapter {
  
  
  public WishRowAdaptor(Context context,
          ArrayList&lt;HashMap&lt;String, String&gt;&gt; arrayList) {
  
      // TODO Auto-generated constructor stub
      this.mData = arrayList;
      this.context = context;
      this.listAq = new AQuery(context);
      // mKeys = mData.keySet().toArray(new String[arrayList.size()]);
  }
  
  /* private view holder class */
  private class ViewHolder {
      ImageView imageView;
      TextView txtWishName;
      ImageButton btn_touchwood;
      ImageButton btn_addwish;
      TextView tvGesture;
      TextView tvNotes;
  }
  
  public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder = null;
  
      final HashMap&lt;String, String&gt; rowItem = (HashMap&lt;String, String&gt;) getItem(position);
  
      LayoutInflater mInflater = (LayoutInflater) context
              .getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
  
      if (convertView == null) {
          convertView = mInflater.inflate(R.layout.row_wish, null);
          holder = new ViewHolder();
  
          holder.txtWishName = (TextView) convertView
                  .findViewById(R.id.tvwishname);
          holder.imageView = (ImageView) convertView
                  .findViewById(R.id.ivWishImage);
          holder.btn_touchwood = (ImageButton) convertView
                  .findViewById(R.id.btn_touchwood);
          holder.btn_addwish = (ImageButton) convertView
                  .findViewById(R.id.btn_addwish);
          holder.tvGesture = (TextView) convertView
                  .findViewById(R.id.tvGestures);
          holder.tvNotes = (TextView) convertView
                  .findViewById(R.id.tvNotesText);
  
          convertView.setTag(holder);
      } else
          holder = (ViewHolder) convertView.getTag();
  
      return convertView;
  }
  }
  </code></pre>
  
  <p>How do update listview so that it should push new changes to list instead replacing all the content. </p>