Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9124915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:40:39+00:00 2026-06-17T06:40:39+00:00

I am getting the cursor value zero when i access it from Broadcast Receiver

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:40:40+00:00Added an answer on June 17, 2026 at 6:40 am
    Cursor c ;
             try{
                c = theDatabase.query("data", new String[] {KEY_CITY, KEY_TIMEZONE, KEY_COUNTRY, KEY_TIMEZONE_DISPLAY_NAME, KEY_TIMEZONE_ID},_ID+" = '"+id+"';", null, null, null, null, null);
             }catch(Exception e){
                    Log.e("CLOCK", "Error getting Timezone for "+KEY_CITY+" : "+e.getMessage());
                    return null;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used cursor on sqlite db for getting records . My code is
This Javascript which uses functions from jQuery is quite handy but getting feedback on
Ok, guys, here's my code for getting SMS: Cursor cursor = getContentResolver().query(Uri.parse(uri), null, CallLog.Calls.DATE
Having this line Cursor c = db.rawQuery(PRAGMA table_info(?), new String[] {tableName}); and getting this:
I have a class, Plotter , which has a static event (declared public static
I'm getting this err msg: System.ArgumentException was unhandled Message=Value with type Devart.Data.Oracle.OracleParameter not supported.
I have a textview that I'm setting the text from a value obtained from
im getting this error: cursor.execute('INSERT INTO COURSE (title) VALUES (?)',(title)) sqlite3.ProgrammingError: Incorrect number of
Using the distance logic from this SO post , I'm getting back a properly-filtered
I was successful in getting a value from the spinner and storing it in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.