java - Use File-class to find readable file in res/raw-directory Android -


i have text-file in res/raw-folder , tried create file-object file file = new file("res/raw/textfile.txt");. got filenotfoundexception , file.exists() returned false.

i want create object in different class , package mainactivity-class guess have pass context(or "this" ?) use reference(?).

i've tried several methods this: file file = context.dosomething("file-path"); end getting filenotfoundexception. , file.exists() returns false.

i have use file because need use file.touri() later on.

is possible find file-path in res/raw-directory , use file object?

edit: got advice put file in assets-folder. this: assets/textfiles/textfile.txt.

i need path string put in file file = new file("file-path");.

edit: tried this: inputstream input = context.getassets().open("textfiles/textfile.txt"); file file = new file(input.tostring()); didn't work either. maybe file-class of no use in android-projects?


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -