0

Do you know why it does not recognize my path?

Uri path = Uri.fromFile(new File("assets/test.xml"));  // tried with "file:///android_asset/test.xml"  
String fileIn = path.getPath();  
FileInputStream fis = new FileInputStream(fileIn);

I get a FileNotFound error at the end, the fis variable.

Thank you very much.

KV Prajapati
  • 92,042
  • 19
  • 143
  • 183
Gabi Radu
  • 1,097
  • 2
  • 16
  • 34
  • possible duplicate of [Using filePath for an xml from assets folder in Android](http://stackoverflow.com/questions/9077302/using-filepath-for-an-xml-from-assets-folder-in-android) – Lalit Poptani Feb 01 '12 at 08:54

1 Answers1

0

getAssets() will return you the asset folder. You get read a file by

InputStream in = getAssets().open("test.xml");

if you are doing this our of Activity. Then you need to call context.getAssets();

Arslan Anwar
  • 18,646
  • 19
  • 75
  • 105