/**
   * 删除文件
   *
   * @param deletePositions 将要被删除的文件在listview的位置的集和
   */
  private void delLocalFile(List<DownloadedBean> delList) {
    //		int size = delList.size();
    //		String[] name = new String[size];
    // //使用迭代器的方式来历遍
    // Iterator<Integer> iterator = delList.iterator();
    // int i = 0;
    // while(iterator.hasNext()){
    // Integer position = iterator.next();
    // DownloadedBean bean = mList.get(position);
    // name[i] = bean.getName();
    // DBUtil.getInstance(getActivity()).deleteData(
    // SQLHelper.TABLE_DOWNLOADED, "name = ?",
    // new String[] { bean.getName() });
    // mList.remove(bean);
    // i++;
    // }

    for (DownloadedBean downloadedBean : delList) {
      //			DownloadedBean bean = delList.get(i);
      //			name[i] = bean.getName();
      DBUtil.getInstance(getActivity())
          .deleteData(
              SQLHelper.TABLE_DOWNLOADED, "name = ?", new String[] {downloadedBean.getName()});
    }
    mList.removeAll(delList);
    Log.i("DownloadedFragment", "删除后的mList集合:" + mList);
    // for (int i = 0; i < length; i++) {
    // mList.remove(mList.get(deletePositions[i]));
    // }
    deleteFile(delList);
    if (adapter != null) {
      adapter.notifyDataSetChanged();
    }
  }
 public void changeData() {
   Cursor cursor = DBUtil.getInstance(getActivity()).selectLastData(SQLHelper.TABLE_DOWNLOADED);
   while (cursor.moveToNext()) {
     DownloadedBean info = new DownloadedBean();
     info.setAuthor(cursor.getString(cursor.getColumnIndex("author")));
     info.setName(cursor.getString(cursor.getColumnIndex("name")));
     info.setProgramId(cursor.getString(cursor.getColumnIndex("program_id")));
     info.setStoragePath(cursor.getString(cursor.getColumnIndex("storage_path")));
     info.setThumb(cursor.getString(cursor.getColumnIndex("thumb")));
     info.setChecked_state(false);
     mList.add(info);
   }
   cursor.close();
   if (adapter != null) {
     adapter.notifyDataSetChanged();
   }
 }
 private void initData() {
   String downloadPath = ConfigUtils.getDownloadPath(getActivity());
   // File file = new File(downloadPath);
   Cursor cursor =
       DBUtil.getInstance(getActivity())
           .selectData(SQLHelper.TABLE_DOWNLOADED, null, "", null, "", "", "");
   if (cursor != null) {
     while (cursor.moveToNext()) {
       DownloadedBean info = new DownloadedBean();
       info.setAuthor(cursor.getString(cursor.getColumnIndex("author")));
       info.setName(cursor.getString(cursor.getColumnIndex("name")));
       info.setProgramId(cursor.getString(cursor.getColumnIndex("program_id")));
       info.setStoragePath(cursor.getString(cursor.getColumnIndex("storage_path")));
       info.setThumb(cursor.getString(cursor.getColumnIndex("thumb")));
       info.setChecked_state(false);
       mList.add(info);
     }
   }
   cursor.close();
 }