问题描述
我想ScoreNinja,全球高评分系统,添加到我的Android游戏,并能正常工作,当我打开它放在我的电话,但是当我将其释放到野外,我崩溃报告说:
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 reports saying:
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
下面是调用堆栈的一部分:
Here is part of the call stack:
android.os.Handler.<init>(Handler.java:121)
android.app.Dialog.<init>(Dialog.java:99)
android.app.AlertDialog.<init>(AlertDialog.java:65)
android.app.AlertDialog.<init>(AlertDialog.java:61)
android.app.AlertDialog$Builder.create(AlertDialog.java:797)
android.app.AlertDialog$Builder.show(AlertDialog.java:812)
com.scoreninja.adapter.ScoreNinjaAdapter.show(ScoreNinjaAdapter.java:136)
com.scoreninja.adapter.ScoreNinjaAdapter.show(ScoreNinjaAdapter.java:99)
我想主线程了prepare()自动调用,如果没有,为什么它会工作对我罚款,但没有其他人?
I thought the main thread had prepare() called automatically, and if not, why would it work fine for me but not anyone else?
推荐答案
我仍然不知道什么是错的,但任何人谁都有同样的问题,它工作得很好,如果你打破了你的游戏放到一个菜单里的活动和游戏活动。有游戏活动返回一个分值菜单活动上一场比赛结束了,然后调用所有的ScoreNinja东西,从菜单中的活动。
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.
这篇关于ScoreNinja导致了java.lang.RuntimeException:内螺纹已经不叫尺蠖prepare无法创建处理器()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!