How to include a txt file, already created, in your Android project

2

I have been reviewing how to work with files on Android and I have done some practices on how to create a file, write about it, read, etc.

But, what if the file I have already created ?, Imagine that I want to insert in my application a file with a list of questions and answers, for example.

I write the file in the format that interests me but then, what do I do ?, how do I add it to the Android project?

    
asked by José Manuel Ortiz Sánchez 02.05.2018 в 18:44
source

1 answer

2

Put it in a folder called "raw" inside the "res" folder (where are the drawables, layouts, etc.

InputStream raw = context.getAssets().open("tufichero.txt");
Reader is = new BufferedReader(new InputStreamReader(raw, "UTF8"));
    
answered by 03.05.2018 / 09:34
source