0

I am not able to find a text file on my local Windows computer to open it in Kotlin - Android Studio. I tried placing the file in an assets folder and I tried various path variations but nothing so far. Some code examples use either the application.open command or something that requires Context. I don't know what to import to enable those commands. Any help would be appreciated.

4
  • How do you intend for the text content to get to the Android device? Is your intention to package it with the app? Commented Mar 18, 2021 at 20:53
  • Good question. I would like the file to be in an assets folder within the app. However, I am open to any solution at this point. Commented Mar 19, 2021 at 20:07
  • "I would like the file to be in an assets folder within the app" -- then do that. Use AssetManager and its open() function to get an InputStream on the asset. You get an AssetManager by calling getAssets() on any Context. See this and this. Commented Mar 19, 2021 at 21:06
  • gist.github.com/r0b0t3d/492f375ec6267a033c23b4ab8ab11e6a // for file path doc Commented Jul 22, 2022 at 5:38

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.