如何删除列表视图文件浏览器中的条目和视频文件? [英] How to delete entry and video file in a listview file browser?

查看:21
本文介绍了如何删除列表视图文件浏览器中的条目和视频文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题描述:我想要一个删除"功能,它可以在列表视图中删除/删除所选条目,同时删除 Video_List 目录中的驻留视频文件字符串,然后刷新列表视图的内容?

Problem description: I wanted a "delete" function which could perform delete/remove of the selected entry in a listview and at the same time delete the residing video file string in the Video_List directory then it refresh the content of the listview?

我是 android/java 新手,有人可以帮我吗?请向下滚动以评估我面临的问题!!有人能告诉我我应该在当前代码中添加什么特定代码来执行上述功能吗?

I'm rather new in android/java can someone help me with it? Do scroll down to evaluate the problem i'm facing please!! Can someone tell me what is the specific code i should add into my current codes to perform the above mention function??

推荐答案

由于您已将您的选择存储到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();

那应该可行!

这篇关于如何删除列表视图文件浏览器中的条目和视频文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆