I am trying to access a file for xml parsing with this:
InputStream inputStream = context.getAssets().open("/mnt/sdcard/cat/bird/flowers.xml");
When it runs i get the following error:
06-13 23:13:22.620: W/System.err(3118): java.io.FileNotFoundException: /mnt/sdcard/cat/bird/flowers.xml
06-13 23:13:22.620: W/System.err(3118): at android.content.res.AssetManager.openAsset(Native Method)
06-13 23:13:22.620: W/System.err(3118): at android.content.res.AssetManager.open(AssetManager.java:314)
06-13 23:13:22.620: W/System.err(3118): at android.content.res.AssetManager.open(AssetManager.java:288)
I have checked the spelling of the file and i have checked the location several times. The file is there and correctly named. What is going on here?
Thanks
getAssets().open(...)is used to access files which you have packaged with the .apk file by placing them in the project’s/assetsdirectory.Trying to open a file with this path…
…means the
AssetManagerwill try to look for a packaged file which you originally placed in your project with the following path…