Skip to content Skip to sidebar Skip to footer

Sqlitequerybuilder Setdistinct Does Not Include All Unique Values In Android Studio

I solved an issue in a previous question but now have a new issue based on what I now need to do. I have about 900 rows in my database and the column in question is called state.

Solution 1:

Rookie mistake by me. I had the cursor statement as follows:

c.movetoFirst()

which is fine as it moves to the first entry.

BUT I then looped through the database as follows:

 reefs.moveToNext();
    do{
        StateDataProvider dataprovider = new StateDataProvider(reefs.getString(1));
        arrayList.add(dataprovider);
    } while (reefs.moveToNext());

I did not remove the

reefs.moveToNext()

as I had copied and pasted that code.

Once I removed the

reefs.moveToNext()

it all works just fine.

Post a Comment for "Sqlitequerybuilder Setdistinct Does Not Include All Unique Values In Android Studio"