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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:49:51+00:00 2026-06-08T18:49:51+00:00

I released a game on the android market recently and got my first error

  • 0

I released a game on the android market recently and got my first error report through ACRA today. The exception is:

java.lang.NullPointerException
at com.sweee.db.AndroidDBHelper.java.util.ArrayList getScores()(SourceFile:65)
at sweee.com.screens.HighScoreScreen.void show()(SourceFile:180)
at com.badlogic.gdx.Game.void setScreen(com.badlogic.gdx.Screen)(SourceFile:59)
at sweee.com.screens.LevelDoneScreen.void render$133aeb()(SourceFile:46)
at com.badlogic.gdx.Game.void render()(SourceFile:46)
at com.sweee.main.SweeeMain.void render()(SourceFile:125)
at com.badlogic.gdx.backends.android.AndroidGraphics.void
onDrawFrame(javax.microedition.khronos.opengles.GL10)(SourceFile:452)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)

Through ACRA I know the device was an Acer Iconia A100 with ICS 4.03 running. I unfortuntly cannot reproduce the error on the emulator (tried connected to the internet and airplane mode). The line on which it claims to throw the NPE, is a call to my Function “isConnected()” which does this:

public boolean isConnected() {
        final ConnectivityManager connectManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);

        // Return true if connected, either in 3G or wi-fi
        final boolean connected = (connectManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED || connectManager.getNetworkInfo(
            ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED);
        return connected;
}

I am pretty much clueless and would like to fix this bug. Is there any general problem with this method to check for an existing internet connection that is specific to ICS 4.03 or the Iconia A100?

Maybe someone who owns an Iconia A100 could do me a favor and try to reproduce the failure? The game is free on android market here. Thank you very much for your time and any possible answer or hint.

edit:

@Override
    public ArrayList<Score> getScores() {

    Cursor c = getWritableDatabase().query("scores", null, null, null, null, null, "points DESC");
    if (c.moveToFirst()) {
        do {
            Score s = new Score(c.getString(1), c.getInt(2), getBoolFromInt(c.getInt(3)), getBoolFromInt(c.getInt(4)));
            if (!scores.contains(s)) {
                scores.add(s);
            }
        } while (c.moveToNext());
    }

    if (isConnected()) {

        syncDB();
    }

    return scores;
}

this is the function that causes the NPE. Line 65 would be

if(isConnected()) {

the ArrayList scores is instantiated when the class gets (one of the first calls of the app, this does not get called before, should therefore not be null).
neither a call to scores.contains(s) nor add should cause a NPE, right?
I just don’t get it. Especially as this code is running fine on meanwhile 9 other devices…

I really appreciate any more help. Thanks!

  • 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-08T18:49:52+00:00Added an answer on June 8, 2026 at 6:49 pm

    I think the error is on this line

    final boolean connected =
            (connectManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED 
            || connectManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED);
    

    That happens because (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); returns null.

    Look at the documentation. It says
    Returns: The service or null if the name does not exist.
    According to this, the name Context.CONNECTIVITY_SERVICE does not exist. Could it be an OS implementation issue? Probably.

    I had a somewhat “similar” situation: I wanted to start an activity to handle the android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS, and on my device it worked (OS 2.3.7), but on some other devices (OS version above and below 2.3.7) it didn’t work. Could it be an OS implementation issue? Most likely.

    Since you can not reproduce the crash,

    1. buy an Acer Iconia A100 with ICS 4.03 and test on it
    2. use some trickery. By this I mean the following:

    Release an update with the following code and hope that your user with the Acer Iconia updates the app:

    public boolean isConnected() {
        final ConnectivityManager connectManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    
        // trickery
        if (connectManager == null) {
            throw new RuntimeException("connectManager is null!");
        }
        // end trickery
    
        // Return true if connected, either in 3G or wi-fi
        final boolean connected =
            (connectManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED 
            || connectManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED);
        return connected;
    }
    

    This way you could get a crash report with this specific message. This way you could deduce some conclusions.

    Anyway, if you just want to make your app work, check connectManager against null.

    Hope this helps.

    EDIT:

    Or, just do the following:

    public boolean isConnected() {
        // final ConnectivityManager connectManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    
        final ConnectivityManager connectManager = null;
    
        // Return true if connected, either in 3G or wi-fi
        final boolean connected =
            (connectManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED 
            || connectManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED);
        return connected;
    }
    

    and see if the stacktrace is the same.

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

Sidebar

Related Questions

I recently released a game on the Android market. It seems to be working
I plan to submit my first iPhone game to the iPhone app store today.
I released my first Android app two weeks ago (an MMO called Agent Syndicate)
Just released my first iOS game on Apple Appstore. (It is accepted by Apple)
I have a game application released at the Facebook platform. I need to set
I have a facebook game application that is released at facebook platform at the
We have a game that is very close to being released, but we have
The iPhone app that I released is a wireless game controller, it translates touches
I released an app that uses Google LVL to the Market many months ago.
Microsoft recently released to preview Azure web sites. I had been hoping that this

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.