Reputation: 7008
In my project I have to make a text file and read particulars from that file. I need to know where I should place the file in directory so that I can successfully read it in my java code?
Upvotes: 3
Views: 1829
Reputation: 6900
If they are files that your app downloads or creates, you should follow the guidelines for using internal storage or external storage, if it is included in the apk, then the file should go in /assets/
and you can access it using the AssetManager.
Upvotes: 0
Reputation: 208042
That should go in /assets/
Read this tutorial also about Android Beginners: Intro to Resources and Assets
AssetManager assetManager = getAssets();
InputStream stream = null;
try {
stream = assetManager.open("file.txt");
} catch (IOException e) {
// handle
}
finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {}
}
}
Upvotes: 2