0

I'm trying to delete a file which is stored on the sd card with file.delete method but that only works when the file is stored on the internal storage?

So how can we delete files which are on the sd card?

I tried this:

File file = new File(selectedFilePath);
boolean deleted = file.delete();

selectedFilePath points to where my file is located and i get the location from Mediastore.Audio.Media.Data

Gamericious Blog
  • 129
  • 2
  • 12

1 Answers1

0

have you added this permission in Manifest?

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

touhid udoy
  • 4,005
  • 2
  • 18
  • 31