如何删除已取消的视频
我正在使用本机相机意图来捕获视频。在 Nexus S 中,如果我捕获视频,那么无论我取消还是按下“确定”,视频文件都会存储在默认的 Medi URI 路径中。但我需要在用户单击“确定”时删除捕获的视频。我正在使用 以下代码调用相机
Intent videoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(videoIntent, CAPTURE_VIDEO);
,以下 ciode 处理取消按钮单击事件
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
try {
if (requestCode == CAPTURE_VIDEO) {if(resultCode == Activity.RESULT_CANCELED)
//pointer comes here successfully. It tells that cancel button is clicked. But I am unabelt to know how to delete the currently cancelled video
}
}
}
I am using Native Camera intent to capture video. In Nexus S If i capture a video then whether i cancel or pressed ok always the video file is getting store in default Medi URI path. But I have a requirement to delete the captured video when user clicks ok. I am using
following code to call camera
Intent videoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(videoIntent, CAPTURE_VIDEO);
and following ciode handles cancel button click event
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
try {
if (requestCode == CAPTURE_VIDEO) {if(resultCode == Activity.RESULT_CANCELED)
//pointer comes here successfully. It tells that cancel button is clicked. But I am unabelt to know how to delete the currently cancelled video
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,这是一些丑陋的方式..
首先从返回的 URI 中获取视频的真实路径,就像
现在你有了视频文件的真实路径,然后使用文件操作你可以删除它。
我怀疑是否有任何方法可以从 android 数据库中删除它。
Ok, Its some ugly way..
First get the real path of the video from returned URI, like
Now you have a real path of video file then using file operation you can delete it.
I doubt if there is available any method to delete it form android database..