且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何删除列表视图文件浏览器中的条目和视频文件?

更新时间:2022-03-28 03:47:26

由于您已将您的选择存储到item"中对象然后在 deleteFile() 方法中,您需要从该对象检索文件路径,以便工作添加行:

Since you have stored your selection into "item" object then in deleteFile() method you need to retreive the file path from that object, for that to work add the line:

model.absolutePath =mfile.getAbsolutePath();

model.absolutePath = mfile.getAbsolutePath();

在 getVideoFiles() 方法中的for"循环.

in getVideoFiles() method 'for' loop.

也在 onCreate 状态之前:

also before onCreate state:

ListViewAdapter lv;

ListViewAdapter lv;

然后在结束状态的 getVideoFiles 中:

then in getVideoFiles at the end state:

  lv = new ListViewAdapter(this, R.layout.row, videoItems);
  setListAdapter(lv); 

最后在 deleteFile() 中你需要声明:

finally in deleteFile() you need to state:

File myFile = new File(item.absolutePath);

File myFile = new File(item.absolutePath);

lv.notifyDataSetChanged();

lv.notifyDataSetChanged();

那应该可行!