Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid - Strings.xml versus text files. Which is faster?
    primarykey
    data
    text
    <p>I have a dictionary database which contains a total of 99,833 words but separated per letter. I am testing dictionaryA.txt which contains 3922 words.</p> <p>Case 1:</p> <p>When I enter a word I wanna look up, lets say "abacus", Using a buffered reader, My app says "Thesis is not responding. Wait - Quit". If I choose wait, it will return the word abacus and its definition.</p> <p>CODE:</p> <pre><code>InputStream inputStream = getResources().openRawResource(R.raw.definitiona); try { BufferedReader in = new BufferedReader(new InputStreamReader(inputStream)); String s = in.readLine(); String delimiter = " - "; String del[]; while(s != null) { s = in.readLine().replaceAll("\\s+", " "); del = s.split(delimiter); if (enhancedStem.equals(del[0])) { in.close(); databaseOutput.setText(s); break; } } in.close(); } catch (FileNotFoundException e) { databaseOutput.setText("" + e); } catch (IOException e1) { databaseOutput.setText("" + e1); } </code></pre> <p>Case 2:</p> <p>When I enter a word I wanna look up, lets say "abacus", using the strings.xml (i transferred the whole 3922 words in a string-array), it says the same. I have to click wait before it responds.</p> <p>CODE:</p> <pre><code>String[] wordA = getResources().getStringArray(R.array.DictionaryA); String delimiter = " - "; String[] del; for (int wordActr = 0; wordActr &lt;= wordA.length - 1; wordActr++) { String wordString = wordA[wordActr].toString(); del = wordString.split(delimiter); if (enhancedStem.equals(del[0])) { databaseOutput.setText(wordA[wordActr]); break; } else databaseOutput.setText("Word not found!"); } </code></pre> <p>Can you tell me which is better? Should I keep using my textfile? Or transfer them to the strings.xml since they both respond slowly anyway? And do you have any idea how I can eliminate the "Not responding" problem? Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload