I have a very strange problem trying to develop for android on eclipse
my program always returned non-meaning, so I tried to debug it.
And now I understand what the problem is. ... the code is literally crazy - it’s completely illogical
this is my code:
ArrayList<String[]> formatedVerses = readAndSplitDatabaseFile(database, books);
if (formatedVerses.size() < 1) { // check if readAndSplitDatabaseFile worked
createDatabase(database, false); // if not. the database wasnt initialized
formatedVerses = readAndSplitDatabaseFile(database, books); // try again
}
return formatedVerses;
I basically create this ArrayList
But when I debug, it just doesn't go through the code from top to bottom, it makes weird illogical jumps
the debugger comes to the line:
ArrayList<String[]> formatedVerses = readAndSplitDatabaseFile(database, books);
then jumps to if statement (how good is that)
if (formatedVerses.size() < 1) {
but "formatedVerses.size () <1" is incorrect, so it should jump over if-block
but instead, the debugger not only jumps INTO into the if-block, but actually switches to the SECOND LINE block:
formatedVerses = readAndSplitDatabaseFile(database, books);
which makes no sense.
I feel like someone is joking at me.
.....
...
.
. :
if (formatedVerses.size() < 1) {
return array1;
} else{
doSomethingElse();
return array2;
}
if-
return array1;
, ,
return array2 else-, doSomethingElse() -line
- ?
...