I am getting the cursor value zero when i access it from Broadcast Receiver class , this is the code which i have use to access value from database
public Cursor select_in(String num)
{
final Cursor cur= db.rawQuery("SELECT incoming FROM contactlist WHERE number=\""+num+"\"",null);
return cur;
}
and this is how I call the function from my Broadcast Receiver Class and i have passed the context of OnReceive Method.
openhelper=new OpenHelper(context);
this.db=openhelper.getWritableDatabase();
this.dh=new DataHelper(context);
String num=phonenumber;
Cursor cur=this.dh.select_in(num);
if (cur.moveToFirst()){
do{
incoming=cur.getInt(cur.getColumnIndex("incoming"));
}while(cur.moveToNext());
}
My operations are not so heavy that it will not get completed within 10 sec as I am using it in broadcast Receiver, I have also closed the database and also the cursor ,please can any one suggest me how to get that value . Thanks In Advance.