I'm trying to read the same file "xmlfile.xml" from the assets folder and also another copy from the SD card sdcard/download/.
I can Read from SD Card:
I can't not Read from Assets folder:
This code il NOT Working
File source = new File("file:///android_asset/xmlfile.xml");
boolean unfile = source.isFile();
boolean Esiste = source.exists();
try
{
// todo
} catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
This code il Working
File source = new File("/sdcard/" + "download" + "/" + "xmlfile.xml");
boolean unfile = source.isFile();
boolean Esiste = source.exists();
try
{
// todo
} catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
someone can explain me how can I read the file from the Assets folder.
thanks marco
To open an asset you'd need the following piece of code:
InputStream is = getAssets().open("xmlfile.xml")