Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: code acts crazy
    primarykey
    data
    text
    <p>I have an extremely strange Problem, while trying to develop for android on eclipse</p> <p>my program always returned non-sense statements, so I tried debugging it.</p> <p>And Now I understand what the problem is.... ...the code acts literally crazy - it's absolutely illogical</p> <p>this is my code:</p> <pre><code>ArrayList&lt;String[]&gt; formatedVerses = readAndSplitDatabaseFile(database, books); if (formatedVerses.size() &lt; 1) { // check if readAndSplitDatabaseFile worked createDatabase(database, false); // if not. the database wasnt initialized formatedVerses = readAndSplitDatabaseFile(database, books); // try again } return formatedVerses; </code></pre> <p>basically I create this ArrayList <p>But when I debug, it doesnt just go trough the code from top to bottom, it makes weird illogical jumps</p> <p>the debugger arrives at the line:</p> <pre><code>ArrayList&lt;String[]&gt; formatedVerses = readAndSplitDatabaseFile(database, books); </code></pre> <p>then jumps to the if-statement (so far so good)</p> <pre><code>if (formatedVerses.size() &lt; 1) { </code></pre> <p>but "formatedVerses.size() &lt; 1" is false, so it should jump over the if-block</p> <p>but instead the debugger not only jumps INTO the if-block, but it actually jumps into THE SECOND LINE of the block:</p> <pre><code>formatedVerses = readAndSplitDatabaseFile(database, books); </code></pre> <p>which makes no sense whatsoever.</p> <p>I feel like somebody is playing jokes on me.</p> <p>I just cant wrap my mind around this.....</p> <p>I've also tried restructuring the code... but it only gets weirder.</p> <p>I've also tried other implementations. for example like this:</p> <pre><code>if (formatedVerses.size() &lt; 1) { return array1; } else{ doSomethingElse(); return array2; } </code></pre> <p>in that case, it jumps into the true-statement of the if-block</p> <pre><code> return array1; </code></pre> <p>and then, when I click on next-step, it actually JUMPS from that line to the <code>return array2</code> line inside of the else-block, while completely leaving out the <code>doSomethingElse()</code>-line</p> <p>anybody got any ideas? because I'm going crazy right now...</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