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

  • Home
  • SEARCH
  • 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 6196939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:43:51+00:00 2026-05-24T03:43:51+00:00

I cant access my SQlite database from my broadcast receiver . Is it even

  • 0

I cant access my SQlite database from my broadcast receiver. Is it even possible? I keep getting a NullPointerException. In the onReceive of the BroadcastReceiver I call

mDbHelper = new ResponderDbAdapter(context);

mDbHelper.open();

Is it something to do with the context? I want to pull database info that gets set in my MainActivity into the BroadCast Receiver.

Ideas?

EDIT :

ERROR:
07-29 16:43:46.491: ERROR/AndroidRuntime(6772): FATAL EXCEPTION: main
07-29 16:43:46.491: ERROR/AndroidRuntime(6772): java.lang.RuntimeException: Unable to start receiver com.test.example.feed.receiver.RecieveSMS: java.lang.NullPointerException
07-29 16:43:46.491: ERROR/AndroidRuntime(6772):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:1805)
07-29 16:43:46.491: ERROR/AndroidRuntime(6772):     at android.app.ActivityThread.access$2400(ActivityThread.java:117)
07-29 16:43:46.491: ERROR/AndroidRuntime(6772):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:981)
07-29 16:43:46.491: ERROR/AndroidRuntime(6772):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-29 16:43:46.491: ERROR/AndroidRuntime(6772):     at android.os.Looper.loop(Looper.java:130)
07-29 16:43:46.491: ERROR/AndroidRuntime(6772):     at android.app.ActivityThread.main(ActivityThread.java:3684)
07-29 16:43:46.491: ERROR/AndroidRuntime(6772):     at java.lang.reflect.Method.invokeNative(Native Method)
07-29 16:43:46.491: ERROR/AndroidRuntime(6772):     at java.lang.reflect.Method.invoke(Method.java:507)
07-29 16:43:46.491: ERROR/AndroidRuntime(6772):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:845)
07-29 16:43:46.491: ERROR/AndroidRuntime(6772):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:603)
07-29 16:43:46.491: ERROR/AndroidRuntime(6772):     at dalvik.system.NativeStart.main(Native Method)
07-29 16:43:46.491: ERROR/AndroidRuntime(6772): Caused by: java.lang.NullPointerException
07-29 16:43:46.491: ERROR/AndroidRuntime(6772):     at com.test.example.feed.receiver.RecieveSMS.onReceive(RecieveSMS.java:67)
07-29 16:43:46.491: ERROR/AndroidRuntime(6772):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:1794)
07-29 16:43:46.491: ERROR/AndroidRuntime(6772):     ... 10 more

EDIT: A Better Explanation

I have a separate activity that allows the user to add items to the database. I want to share this with the receiver so that the broadcast receiver knows what items are in the database. ResponderDbAdapter is a class that accesses the Db and performs fetches and inserts to the DB. What would the context be…if I have the broadcast receiver running even if the application is closed how can it access a database?

  • 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-05-24T03:43:52+00:00Added an answer on May 24, 2026 at 3:43 am

    The Broadcast Receivers version of the context is probably not working for the DBHelper. Have the Receiver fire up a service and have the service access the DB

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When a class is customized, by using its outlet , you cant access its
Hey, I can't seem to access the returned value from a method I called
I'm using an sqlite database in my app. I have this dbhelper class in
This is PhpSecInfo Report for our servers: alt text http://img375.imageshack.us/img375/9104/security.jpg I cant access to
I am trying to create a class to abstract my SQLite methods from my
i want to have access to LinqToSqlClasses (mydbDataContext) class from another solution project. in
I would like to know how I can access the copy of my sqlite
I currently have a DataGridView bound to an sqlite database in c:\temp. I bind
I wrote a java program that should fill a sqlite database with some rows
I have a .csv file that I turned into an SQLite database with the

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.