Skip to content Skip to sidebar Skip to footer

Scoreninja Causes Java.lang.runtimeexception: Can't Create Handler Inside Thread That Has Not Called Looper.prepare()

I'm trying to add ScoreNinja, the global high score system, to my Android game, and it works fine when I load it on my phone, but when I release it into the wild, I got crash repor

Solution 1:

I'm still not sure what was wrong, but for anyone who has the same problem, it works fine if you break up your game into a menu Activity and a game Activity. Have the game activity return a score to the menu activity on a game over, then call all the ScoreNinja stuff from the menu activity.

Solution 2:

I imagine you're creating the handler outside of the main thread. Create the handler in the onCreate of your activity or something similar, something that'll definitely be in the main thread, and then you can call handler.post(runnable) inside your other thread.

Post a Comment for "Scoreninja Causes Java.lang.runtimeexception: Can't Create Handler Inside Thread That Has Not Called Looper.prepare()"