I am trying to delete a video file from the gallery but the below code is not working properly.
It deletes only the content, but the video remains in the gallery and when I try to play the video it says that the video cannot be played.
public void deleteVideo(View view)
{
File f = new File(delete);
f.delete();
if(f.exists())
{
try
{
Toast.makeText(
TestVideoRecordingActivity.this,
"inside try",
Toast.LENGTH_SHORT
).show();
f.getCanonicalFile().delete();
}
catch (IOException e)
{
e.printStackTrace();
dialog.dismiss();
}
}
dialog.dismiss();
}