-
Notifications
You must be signed in to change notification settings - Fork 12
Reading and writing from files stored in assets folder
rutura edited this page Apr 17, 2017
·
1 revision
- API LEVEL : 1
- Make sure you have an "assets" folder alongside java and res in your project I usually go to file explorer and create it myself and android studio picks it up.
- Put your assets in there.In this example data.csv is used
- Use AssetManager to get an InputStream you use to read from the asset file like this:
//Access application assets
AssetManager manager = getAssets();
//Open our data file
InputStream in = manager.open("data.csv");
- How do you write? You don't.Assets resources are read only for apps.
- The rest is standard Java reading and parsing.Look at the parse method .