This is the method through which I would like to store the words in an arraylist and write them to the database.
public void loadWords(Context context) {
AssetManager am = context.getAssets();
wordList = new ArrayList<String>();
try {
InputStream inputStream = am.open("english-words-lowercase.txt");
InputStreamReader inputStreamReader = new InputStreamReader(
inputStream);
BufferedReader bufferedReader = new BufferedReader(
inputStreamReader);
word = bufferedReader.readLine();
while(word!=null){
wordList.add(word);
word = bufferedReader.readLine();
}
} catch (IOException e) {
e.printStackTrace();
}
}
So now I have an ArrayList with all the words I would like to use. How can I store it into a database so that I can read it whenever I want? And I will be using it to validate words that users will input, is this the best way to store the words or should I use a HashMap or some other storing techniques? Thank you!