I have to retreive a string from database using their id.I done thet retreival,But it is returning as some object format not as a string.Please help me..
My retreival place:
db.open();
for(int i=1;i<=5;i++)
{
if(i==1)
group1=db.getspintitle(1);
if(i==2)
group1=db.getspintitle(2);
if(i==3)
group1=db.getspintitle(3);
if(i==4)
group1=db.getspintitle(4);
if(i==5)
group1=db.getspintitle(5);
}
db.getspintitle() method:
public String getspintitle(int rowId)throws SQLException
{
String sumtotal="";
Cursor cursor1 = db.rawQuery(
"SELECT spin from spinner WHERE _id='rowId'", null);
sumtotal=cursor1.toString();
cursor1.close();
return sumtotal;
}
For your information, The below returns you the
Cursor, not the simple String.To retrieve value from the cursor, you have to iterate through the cursor.
Now, here in your case, you can do as below: