我的问题有点棘手来形容。新文件(路径)总是说没有文件
我在我的项目(和在apk文件中)有一个分离的资源文件夹。
String path = "/resources/instruments/data/bongo/audio/bong1.wav";
我已经可以用
url = StreamHelper.class.getClassLoader().getResource(path);
url.openStream();
使用它,但实际上我想将文件加载到的Soundpool。 我试着这样说:
SoundPool soundPool = new SoundPool( 5, AudioManager.STREAM_MUSIC, 0);
soundPool.load (path, 1);
...但我总是得到一个错误信息:“错误加载/ resourc ......”
load(String path, int) 在这个环节我见过,我需要正确的路径文件
File file = new File(path);
if(file.exists())
//always false but i thing if it would be true soundPool.load should work too
现在我的问题:它的路径是如何工作的。还是有任何其他的想法,我的问题(与AssetManager p..)?
顺便说一句。我知道有特殊的Android方法来获取像R.id.View这样的资源......但在我的情况下,处理起来并不容易。
谢谢!
这在我的情况下不起作用。我不知道为什么,但资源仍然没有找到。这太遗憾了,因为它会容易得多:) – 2010-12-19 14:35:50