getAssets()openFD()失敗。Android getAssets()。openFd(string) - 文件未找到
AssetFileDescriptor fileFD=null;
File file = new File(Environment.getExternalStorageDirectory() + "/Music/ckyws8.wav");
fileFD = getAssets().openFd(file.toString()); //FAILS
日誌顯示: java.io.FileNotFoundException:/mnt/sdcard/Music/ckyws8.wav
即使file.exists()
回報true
,也是測試:
File tempath = new File(Environment.getExternalStorageDirectory() + "/Music");
int files = tempath.list().length;
for(int f=0;f<files;f++){
Log.d(LOG_TAG,tempath.list()[f].toString());
}
返回包含列表ckyws8.wav
任何想法?
以前的答案,儘可能短,是有幫助的。如果其他人遇到同樣的誤解,那麼我就改變了代碼的工作方式。 – NMKloster