如何将文件添加到Android项目,将其部署到设备,然后打开它?

Mus*_*sis 6 eclipse file-io android android-manifest

我在Eclipse(Helios)中有一个Android(2.2)项目.我想在项目中添加一个MP3文件,以便将MP3文件与应用程序一起部署到设备中.

然后我想打开文件作为File对象,这意味着我需要知道设备上文件的完整路径(?),但我不知道如何在Android中指定路径.

Pau*_*ire 12

显然,Froyo中存在一个阻止WAV播放的错误.
音频文件应放在项目的"res/raw"目录中.然后使用id播放它(或尝试播放它)

MediaPlayer mp = MediaPlayer.create(context, R.raw.sound_file_1);
mp.start();

信息:http ://developer.android.com/guide/topics/media/index.html
示例(mp3):http://www.helloandroid.com/tutorials/musicdroid-audio-player-part-i

  • 没有更多的WAV!没有更多的WAV!:) (2认同)