if(cursor.getCount() !=0)
{
if(cursor.moveToFirst())
{
do
{
pObj.gritSize=cursor.getString(cursor
.getColumnIndex("grit"));
pObj.test = cursor.getString(cursor
.getColumnIndex("sieve"));
pObj.number = cursor.getString(cursor
.getColumnIndex("number"));
pObj.micro = cursor.getString(cursor
.getColumnIndex("micro"));
pObj.ret = cursor.getString(cursor
.getColumnIndex("retention"));
pList.add(pObj);
}while(cursor.moveToNext());
}
}
return pList;
I have the above code that fetches data from table. I am getting correct values in each iteration in pObj. But when i add pList.add(pObj); each time, it is overwriting the previous entry and adding the value. Hence at the end of the iteration i am getting last row as each item in the arraylist. Please help.