Query the Uri for the MediaStore.Audio.Media.DATA column. It contains the path to the file.
On Sun, Apr 19, 2009 at 1:59 PM, estivenrpo <[email protected]> wrote: > > mm, ok, thanks but, how do i delete a uri media file manually? > > I only have the uri string: "content://media/external/audio/media/ > 149" and i don't know how to create a file object with that. > > I have tried: > > File fileToDelete = new File(new URI("content://media/external/audio/ > media/149")); > fileToDelete.delete(); > > but it doesn't work. > > Thanks in advance, > > > > On 19 abr, 10:19, Marco Nelissen <[email protected]> wrote: > > This is a problem with the media provider: it will delete the entry from > the > > database, but won't delete the underlying file. For now, you'll have to > do > > that yourself. > > > > On Sat, Apr 18, 2009 at 11:01 AM, estivenrpo <[email protected]> > wrote: > > > > > Hi guys > > > > > I have a Uri like "content://media/external/audio/media/149" that is a > > > audio file and i want to delete it > > > i have tried: > > > > > Uri fileUri = Uri.parse("content://media/external/audio/media/149"); > > > c.getContentResolver().delete(fileUri, null, null); > > > > > I have also tried: > > > > > File fileToDelete = new File(new URI("content://media/external/audio/ > > > media/149")); > > > fileToDelete.delete(); > > > > > The file was created using the Sound recorder Intent. Actually, if I > > > create a MediaPlayer mp, I can set the source: > > > > > mp.setDataSource(QueryResults.this, Uri.parse(fileUri)); > > > and then: > > > > > mp.prepare(); > > > mp.start(); > > > > > and the file is CORRECTLY played. > > > > > So if i want to delete the file i can't, why?, permision problems > > > maybe, because my app doesn't create the file..?? > > > > > Thanks in advance. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

