Android:我收到报告“无法在未调用 Looper.prepare() 的线程内创建处理程序”添加 ScoreNinja 后
当我将 ScoreNinja 添加到我的 Android 应用程序并将其发布到市场后,我收到“无法在未调用 Looper.prepare() 的线程内创建处理程序”的报告。
似乎这种情况不会一直发生,因为 ScoreNinja 的高分有很多来自用户的条目。
我在网上寻求帮助,但没有明确的指导说明该怎么做。
我使用的 ScoreNinja 代码与 ScoreNinja 网站上显示的完全一样。
感谢您的任何帮助。
Dave B
顺便说一句,如果有人遇到 ScoreNinja 仅显示一个分数的问题,请检查清单中的启动模式是否未设置为“单实例”。这为我解决了!
I am getting reports of 'Can't create handler inside thread that has not called Looper.prepare()' once I added ScoreNinja to my Android app, and released it to the market.
It seems that it isn't happening all the time as the ScoreNinja highscore has lots of entries from users.
I have looked on the web for help but there are no clear directions on what to do.
I have used the ScoreNinja code exactly as shown on the scoreninja website.
Thanks for any help.
Dave B
BTW If anyone is having problems with ScoreNinja only displaying one score, check to see if the launchmode is not set to 'singleinstance' in your manifest. This fixed it for me!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保在应用程序生命周期方法(例如
onCreate()
)中初始化所有内容,而不是静态最终字段。Make sure you initialize everything inside app lifecycle methods (e.g.
onCreate()
) and not as static final fields.请参阅:
ScoreNinja 导致 java.lang.RuntimeException: Can' t 在未调用 Looper.prepare() 的线程内创建处理程序
它修复了我在游戏线程结束后在正常活动中调用 .show() 的问题。
See:
ScoreNinja causes java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
It fixed it for me to call .show() in a normal activity after the game thread has ended.