0

I need to know if the media player can access an mp3 file that is stored in getFilesDir() if it is possible, tell me please

David
  • 3
  • 5

1 Answers1

0

You are looking for getFilesDir(), since that allows editing of your files and it is local to your app. However upon app uninstallation, this directory will be deleted.

If you don't need your files modified, the res/raw folder works nicely.

A--C
  • 36,351
  • 10
  • 106
  • 92
  • ok there is no problem. All I want is to play an mp3 file that is in getFilesDir() ... can I ?? – David Dec 18 '12 at 23:42
  • Where is the mp3 coming from? If it's from your own app, there is no point in using getFilesDir(). MAke a new folder in the res folder called `raw` and put your mp3 there. To access it, [this](http://stackoverflow.com/questions/4162230/how-do-i-play-an-mp3-in-the-res-raw-folder-of-my-android-app) SO question may help. – A--C Dec 18 '12 at 23:44
  • no, I downloaded the mp3 file using the application and saved it in files directory. and now I need to play the music file using MediaPlayer. is there any way ?? – David Dec 18 '12 at 23:46
  • Ah, that's completely different. That is on the world-readable/writable storage (so the internal and external sd card). Something like [this](http://android-er.blogspot.ca/2010/07/play-mp3-in-sd-card-using-androids.html) should help. If the mp3 is on the external sd, you may need the [READ_EXTERNAL_STORAGE](http://developer.android.com/reference/android/Manifest.permission.html#READ_EXTERNAL_STORAGE) permission. – A--C Dec 18 '12 at 23:48