Reputation: 2545
I am new to Android application, create one xml file data.xml
inside the Resource folder, then i tried to access that local xml file, but i can't get it.
But android resource folder and open rawresource to the raw folder under res inside xml file
data.xml
using this way, i access that xml file like:
InputStream is = this.getResources().openRawResource(R.raw.data);
but using local xml file cannot access, please help me.
Thanks
Upvotes: 0
Views: 3759
Reputation: 29199
raw xmls should be in Assets folder, and to access files from assets folder use:
AssetManager assetManager = getAssets();
InputStream in= assetManager.open("data.xml");
Upvotes: 4
Reputation: 7888
Add your data.xml
file under raw folder
.After inserting into it you will not get this sort of error.
Upvotes: 0