accessing file from assets
I've tried File file = new File("file:///android_asset/something.xml")
and it doesn't seem to work. It worked when I tried loadin开发者_如何转开发g up html in a webview, but won't work when I'm trying to get at an xml file I've stored there so I can parse it with DocumentBuilder
.
What gives? I'm guessing I can't access a file like that.
Here's the Exception
: java.io.FileNotFoundException: /file:/android_asset/something.xml (No such file or directory)
Is it escaping out some of the slashes? if so, how do I get 'em back?
I have noticed that there is a similar problem I had in the past. You have to use Activity.getAssets().open(...)
as you cant create instance that way in android environment. Here is the link to the forum that helped me solve my problem. Hope it helps, let us know if that works.
精彩评论