Where is the internal file stored in the Android project?

In my project, I have to make a text file and read the data from this file. I need to know where should I put the file in a directory so that I can successfully read it in my java code?

+3
source share
2 answers

If these are files that are downloaded or created by your application, you should follow the recommendations for using internal storage or external storage , if it is included in apk, then the file should go to /assets/and you can access it using AssetManager .

0
source

It should be in /assets/

Android Beginners:

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) {}
         }
}
+2

Source: https://habr.com/ru/post/1754236/


All Articles