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
  • 93,659
  • 19
  • 148
  • 186
Gabi Radu
  • 1,107
  • 2
  • 16
  • 35
  • 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,746
  • 19
  • 76
  • 105