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
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   if (mMode != null) {
     // mAdapter.checked(position);
     CheckBox cb = (CheckBox) view.findViewById(R.id.download_checked);
     cb.setChecked(!cb.isChecked());
   } else {
     DownloadJob item = mAdapter.getItem(position);
     if (item != null) {
       startToPlay(item.getEntry());
     }
   }
 }
  private void initView() {
    mListView = (ListView) findViewById(android.R.id.list);
    mStateView = (TextView) findViewById(R.id.time_out_text);
    mAdapter = new DownloadJobAdapter(this);
    mAdapter.setOnItemCheckedListener(
        new OnItemCheckedListener() {

          @Override
          public void onCheckedChanged(CompoundButton cb, boolean isChecked) {
            if (mAdapter.getCheckedCount() < 1) {
              if (mMode != null) mMode.finish();
            } else if (mMode == null) {
              mMode = startSupportActionMode(new DownloadActionMode());
            }
          }
        });
    mListView.setAdapter(mAdapter);
    mListView.setOnItemClickListener(itemClickListener);
  }
 // @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();
 }