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 9253381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:12:18+00:00 2026-06-18T11:12:18+00:00

I’m receiving random NullPointerException crash reports from Google that can’t be reproduced. I’m using

  • 0

I’m receiving random NullPointerException crash reports from Google that can’t be reproduced. I’m using a static reference to a class that extends OrmLiteSqliteOpenHelper. The helper is initialised in the main class that extends SherlockFragmentActivity.

if (DatabaseHelper.getInstance() == null) {
    DatabaseHelper.setInstance(this.getApplicationContext());
}

At first I though it may occur when the device is rotated or sent to the background. But no amount of testing has been able to recreate the issue.

Nowhere in the code is the static mHelper variable set to null

public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
    …
    private static DatabaseHelper mHelper;
    …
    public static DatabaseHelper getInstance() {

        return DatabaseHelper.mHelper;
    }

    public static void setInstance(Context context) {

        DatabaseHelper.mHelper = new DatabaseHelper(context);
    }
    …
}

Does anyone have any idea of what may be causing this?

Follows is one of the reports:

java.lang.RuntimeException: Unable to start activity ComponentInfo{au.com.dcbs.tradies/au.com.dcbs.tradies.presentation.document.DocumentActivity}: java.lang.NullPointerException
 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2049)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2083)
at android.app.ActivityThread.access$600(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1233)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4697)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at bd.a(Document.java:654)
at au.com.dcbs.tradies.presentation.document.DocumentActivity$a.b(DocumentActivity.java:102)
at au.com.dcbs.tradies.presentation.document.DocumentActivity$a.onActivityCreated(DocumentActivity.java:78)
at e.a(FragmentManager.java:891)
at e.a(FragmentManager.java:1080)
at e.a(FragmentManager.java:1062)
at e.k(FragmentManager.java:1810)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:501)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1133)
at android.app.Activity.performStart(Activity.java:4549)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2022)
... 11 more

line 654 is the first line in this method:

public static Document get(long id, Context context) {

    DocumentEntity entity = DatabaseHelper.getInstance().getDocumentDao().queryForId((int)id);
    Document doc = new Document(entity, context);
    return doc;
}

getDocumentDao returns an object of type com.j256.ormlite.dao.RuntimeExceptionDao

  • 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-18T11:12:19+00:00Added an answer on June 18, 2026 at 11:12 am

    It would help if you post the code where the problem occurs

    at bd.a(Document.java:654)
    

    But as general suggestion that might resolve your problem, you can consider initializing the database helper in an application class not in any activity, since it seems that it is something used for the entire application and does not depend on specific activity context.

    Edit

    I think you need to break the code at line 654 because it is difficult to tell which function returns null. e.g.

    DatabaseHelper helper = DatabaseHelper.getInstance();
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am maintaining one extension for google chrome and I'm receiving complaints from random
I am receiving an error with this code that pops up Class file editor:
When receiving data through a socket using recv , I've noticed that, with: char
I have a website that grabs a random entry from a database and displays
I'm receiving event notifications from web services that trigger event handlers with data regarding
I receiving a undefined reference error when try to compile an c++ program. I'm
I have been receiving this error for a while when using devenv on an
I have a program that captures all key presses using pyHook, then runs a
We've implemented a background service in our Asp.Net web app that receives messages from
I am using the autobhan websockets library with the following code: from twisted.internet import

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.