0

How can I specify the path to the desired file? I Have a .txt file in the assets directory (below main directory).

try {
    readDataFromFile = new String(Files.readAllBytes((Paths.get("secondlevel.txt"))));
} catch (IOException e) {
    e.printStackTrace();
}

How can I get the correct path?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • 1
    Does this answer your question? [Opening a File from assets folder in android](https://stackoverflow.com/questions/1933015/opening-a-file-from-assets-folder-in-android) – emandt Apr 02 '21 at 15:35
  • Somewhat, thanks. I also just realized that, for some reason, Arrays.toString does not print out the entire string but just the first entries. The only thing that works is a long for loop that prints everything individually. I spent the last hour trying to understand why not the entire string was taken from file. Ah the wonders of programming. Thanks for taking the time to answer me – FiveJungYetNoSmite Apr 02 '21 at 15:48

0 Answers0