0

Other people have similar errors, although this one is different, speciialy because of the getListView()

java.lang.NullPointerException: Attempt to invoke virtual method 'android.widget.ListView cookiemaster.cookieclicker.MainActivity$ItemsList.getListView()' on a null object reference

  @Override
public void TimerTick()
{
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            totalCookies.setText("Total: " + Beautify.CommaSeparate((int)(Game.getInstance().getTotal())));
           CookiesPerSec.setText(Beautify.CommaSeparateDouble(Math.round(Game.getInstance().getCps() * 100.0) / 100.0) + " CPS");


            try{ ItemsList.getListView().invalidateViews(); }
            catch(IllegalStateException e){}
        }
    });
}

Logcat:

 java.lang.NullPointerException: Attempt to invoke virtual method 'android.widget.ListView cookiemaster.cookieclicker.MainActivity$ItemsList.getListView()' on a null object reference
            at cookiemaster.cookieclicker.MainActivity$3.run(MainActivity.java:136)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Jared Burrows
  • 54,294
  • 25
  • 151
  • 185
Josh Marzi
  • 11
  • 2

0 Answers0