I'm using Android Studio 2.0 and I've created an Android library to keep some classes and a XML data file. The file is placed in the /res directory but I cannot find any way to access it. I always get a FileNotFoundException
.
The code I use to open and serialize the file is:
try {
SomeClass someClass = new SomeClass();
someClass.entries = new ArrayList<SomeEntry>();
Serializer serializer = new Persister();
InputStream file=assetManager.open("simple.xml");
someClass= serializer.read(SomeClass.class, file);
}
catch (Exception ex)
{
ex.getMessage();
}