private void setLoadMoreViews() {
   headerView = (LoadMoreListItem) getLayoutInflater().inflate(R.layout.load_more, null);
   headerView.showHeaderText();
   footerView = (LoadMoreListItem) getLayoutInflater().inflate(R.layout.load_more, null);
   footerView.showFooterText();
   getListView().addHeaderView(headerView);
   getListView().addFooterView(footerView);
 }
 public void statusesLoaded(LoadMoreStatusesResult result) {
   setProgressBarIndeterminateVisibility(false);
   if (result.newer) {
     headerView.hideProgress();
     adapter.appendNewer(result.statuses);
     getListView().setSelection(1);
   } else {
     footerView.hideProgress();
     adapter.appendOlder(result.statuses);
   }
 }
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   if (v.equals(headerView)) {
     headerView.showProgress();
     loadNewerTweets();
   } else if (v.equals(footerView)) {
     footerView.showProgress();
     loadOlderTweets();
   } else {
     // Watch out! Doesn't account for header/footer! -> Status status = adapter.getItem(position);
     Status status = (Status) getListView().getItemAtPosition(position);
     Intent intent = new Intent(this, StatusDetailActivity.class);
     intent.putExtra(StatusDetailActivity.STATUS, status);
     startActivity(intent);
   }
 }
 private void loadOlderTweets() {
   footerView.showProgress();
   new LoadMoreAsyncTask(this, twitter, adapter.getLastId() - 1, false).execute();
 }
 private void loadNewerTweets() {
   headerView.showProgress();
   new LoadMoreAsyncTask(this, twitter, adapter.getFirstId(), true).execute();
 }