资产。为什么OpenFD取决于文件的类型?

时间:2012-03-15 08:51:35

标签: android midi assets

我把文件alma_mater.kar放到文件夹资产/声音中 当我尝试获取AssetsFileDescriptor时,发生错误

    AssetFileDescriptor afd = this.getResources().getAssets().openFd("sounds/alma_mater.kar");
]


当我把重命名的文件alma_mater.mid,没有错误。 为什么呢?
基于Google API [Android 2.2]的项目在eclipse上 我的设备是LG P500(Optimus One)更新到V20d(Android 2.3.3)

  

03-15 10:23:15.959:W / System.err(32076):   java.io.FileNotFoundException:此文件无法作为文件打开   描述;可能是压缩了这个03-15 10:23:15.959:   W / System.err(32076):at   android.content.res.AssetManager.openAssetFd(Native Method)
03-15   10:23:15.959:W / System.err(32076):at   android.content.res.AssetManager.openFd(AssetManager.java:330)

1 个答案:

答案 0 :(得分:0)

根据快速谷歌搜索和您的例外内容,我怀疑Android将KAR文件视为"keep-it archive" files而不是MIDI文件。有没有什么理由你不能用.mid命名,只是把它解析为KAR文件?