private void updateListView(int position) {
   List<DownloadJob> jobs = null;
   switch (position) {
     case 1:
       jobs = mDownloadMan.getQueuedDownloads();
       break;
     case 2:
       jobs = mDownloadMan.getCompletedDownloads();
       break;
     default:
       jobs = mDownloadMan.getAllDownloads();
       break;
   }
   if (lastNavPosition == position && jobs != null && jobs.size() == mAdapter.getCount()) {
     mAdapter.notifyDataSetChanged();
   } else {
     mAdapter.setData((ArrayList<DownloadJob>) jobs);
     mListView.setVisibility(View.VISIBLE);
     mStateView.setVisibility(View.GONE);
   }
   mBar.setTitle("共" + mAdapter.getCount() + "个下载项");
   if (jobs.isEmpty()) {
     mStateView.setText(getString(R.string.no_download));
     mStateView.setVisibility(View.VISIBLE);
     mListView.setVisibility(View.GONE);
   }
 }
 @Override
 protected void onStop() {
   super.onStop();
   mDownloadMan.unregisterDownloadObserver(this);
   try {
     unbindService(conn);
   } catch (Exception e) {
   }
 }
    @Override
    public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
      switch (item.getItemId()) {
        case R.id.menu_download_delete:
          int i = 0;
          for (DownloadJob job : mAdapter.getCheckedJobs()) {
            mDownloadMan.deleteDownload(job);
            i++;
          }
          AcApp.showToast("删除完毕 - 共" + i + "项");
          break;
        case R.id.menu_download_resume:
          AcApp.showToast("继续");
          for (DownloadJob job : mAdapter.getCheckedJobs()) {
            if (job.getProgress() != 100) {
              job.setListener(mDownloadService.mJobListener);
              job.resume();
              mDownloadMan.getProvider().resume(job);
            }
          }
          break;
        case R.id.menu_download_pause:
          AcApp.showToast("暂停");
          for (DownloadJob job : mAdapter.getCheckedJobs()) {
            if (DownloadManager.isRunningStatus(job.getStatus())) {
              job.setListener(mDownloadService.mJobListener);
              job.pause();
            }
          }
          break;
        case R.id.menu_select_all:
          mAdapter.checkedAll();
          break;
      }

      return true;
    }
 // @Override
 // public boolean onCreateOptionsMenu(Menu menu) {
 // menu.add(0,R.id.edit_query,0,"编辑").setIcon(R.drawable.ic_menu_mark).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
 // return true;
 // }
 @Override
 protected void onStart() {
   super.onStart();
   mDownloadMan.registerDownloadObserver(this);
   mAdapter.notifyDataSetChanged();
 }