I have set up a query and a cursor. My problem is my cursor seems to be moving 1 column at a time. 
my table is set up with first column as the description string, second column is the grade value and the third column is the weight value.

this is my query:

```
String[] columns = {Calc_db.COLUMN_GRADE_VALUE, Calc_db.COLUMN_WEIGHT_VALUE};
        Cursor cursor = openClass.getBd().query(Calc_db.TABLE_NAME, columns, null, null, null, null, null);

```

I am trying to retrieve the grade and weight value so I can put them in a list. 

```
cursor.moveToFirst();
        while (cursor.moveToNext()){
            Double dbGrade = cursor.getDouble(cursor.getColumnIndex(Calc_db.COLUMN_GRADE_VALUE));
            //cursor.moveToNext();
            Double dbWeight = cursor.getDouble(cursor.getColumnIndex(Calc_db.COLUMN_WEIGHT_VALUE));
            gradeWeightList.add(dbGrade);
            gradeWeightList.add(dbWeight);

```

My problem is the cursor is going through 1 column at a time for each loop iteration. It is also going through all 3 columns even though I am only selecting for the second 2 (grade and weight). 

example:

If i input : description, 0.7, 0.5 (row 1) decript, 0.6, 0.4 (row 2)

I receive:

loop 1: grade = 0.7, weight = 0.0

loop 2: grade = 0.7, weight = 0.5 

loop 3: grade = 0.7, weight = 0.5

loop 4: grade = 0.6, weight = 0.5

loop 5: grade = 0.6, weight = 0.4

What I want is for 

loop 1: grade = 0.7, weight = 0.5

loop 2: grade = 0.6, weight = 0.4
['https://Stackoverflow.com/questions/25353460', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3943131/']
I see some bugs in your code. **First bug**:

```
cursor.moveToFirst();
while (cursor.moveToNext()) { 
    ...
}

```

This code will skip the first row. You are moving to the first row with `moveToFirst`, then you are moving to the second row with `moveToNext` when the `while` loop condition is evaluated. In general, I prefer to iterate over a cursor using a `for` loop like so:

```
for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
    ...
}

```

This code will work no matter what position the cursor was at before the `for` loop started.

**Second bug**:

```
Double dbGrade = cursor.getDouble(...);
Double dbWeight = cursor.getDouble(...);
gradeWeightList.add(dbGrade);
gradeWeightList.add(dbWeight);

```

Notice you are adding both doubles to the same list (which you call `gradeWeightList`). I presume you have different lists for the grades and weights? While you could simply change the line that is incorrect, you might want to consider making a class that encapsulates the grade data, e.g.

```
public class GradeData {
    double grade;
    double gradeWeight;
    /* constructors and methods omitted */
}

```

... and use a single list of this type of object. For each row, make a new instance of this class, set its properties, and add it to your list. That way you aren't trying to manage disparate lists and keep them all in sync, especially if you decide that your grade data needs more attributes (which in your current implementation would mean adding a third list).
For those of interested this is how I fixed my problem:

(Thanks for the advice Karakuri) 

```
public List<Entry> populateList(){
    List<Entry> gradeWeightList = new ArrayList<Entry>();
    Cursor cursor = data.getBd().query(Calc_db.TABLE_NAME, null, null, null, null, null, null);

    for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
        String dbDescript = cursor.getString(cursor.getColumnIndex(Calc_db.COLUMN_DESCRIPTION_VALUE));
        Double dbGrade = cursor.getDouble(cursor.getColumnIndex(Calc_db.COLUMN_GRADE_VALUE));
        Double dbWeight = cursor.getDouble(cursor.getColumnIndex(Calc_db.COLUMN_WEIGHT_VALUE));
        Entry e1 = new Entry (dbDescript, dbGrade, dbWeight);
        gradeWeightList.add(e1);    
    } 
    cursor.close();

    return gradeWeightList;

}

```

Entry Class

```
public class Entry {
private double GRADE;
private double WEIGHT;
private String DESCRIPT;

public Entry(){
    GRADE = 0;
    WEIGHT = 0;
    DESCRIPT = " ";
}

public Entry(String description, double grade, double weight){
    GRADE = grade;
    WEIGHT = weight;
    DESCRIPT = description;
}

public String getDESCRIPT(){
    return DESCRIPT;
}
public double getGRADE(){
    return GRADE;
}

public double getWEIGHT(){
    return WEIGHT;
}

public void setDESCRIPT(String description){
    DESCRIPT = description;
}

public void setGRADE(double grade){
    GRADE = grade;
}

public void setWEIGHT(double weight){
    WEIGHT = weight;
}

```

}