java.io.FileNotFoundException: (No such file or directory) android
java.io.FileNotFoundException: (No such file or directory) android
I'm trying to open XML file here but it always throws an exception that,
The file does not exist
i.stack.imgur.com/rq6fF.png
– Ali Al-Hudhud
Aug 19 at 12:03
you can't read file like this. take a look at this answer. it is in java but you will have an Idea how to read. stackoverflow.com/a/44838606/3155082
– Jawad Zeb
Aug 19 at 12:08
Please don't post screenshots of code, XML, or logcat output. Please post all text as text.
– Mike M.
Aug 19 at 12:15
@MikeM. sorry this is the first time i ask here
– Ali Al-Hudhud
Aug 19 at 12:27
1 Answer
1
Here is the Code To Read from Resource (Tested)
val _is = resources.openRawResource(R.raw.data)
val reader = BufferedReader(InputStreamReader(_is))
val data = StringBuffer()
val line = reader.readLine()
while (line != null)
data.append(line!! + "n")
val resourceData = (data.toString())
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Please post code.
– Jawad Zeb
Aug 19 at 12:02