java - Getting error on files.readAllLines -
i working in android. reading file content, using method
list<string> lines = files.readalllines(wiki_path);
but whem using method getting error:
the method readalllines(path) undefined type mediastore.files.
why can compiler not find method?
path wiki_path = paths.get("c:/tutorial/wiki", "wiki.txt"); try { list<string> lines = files.readalllines(wiki_path); (string line : lines) { if(url.contains(line)) { other.put(tag_title, name); other.put(tag_url, url); otherlist.add(other); break; } } }
the method you're trying use member of java.nio.file.files
- class (and indeed package) doesn't exist on android. if java 7 version existed, you're trying use method introduced in java 8. files
class you've imported android.provider.mediastore.files
entirely different class.
even if compiled, path you're providing looks ever windows path, wouldn't work on android device...