gpt4 book ai didi

android - GCMIntentService + 在死线程上向处理程序发送消息

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:57:49 25 4
gpt4 key购买 nike

我的应用程序运行正常,但我遇到了以下错误:

10-04 14:04:38.182: W/MessageQueue(8625): Handler (android.media.MediaPlayer$EventHandler){416ad6b0} sending message to a Handler on a dead thread
10-04 14:04:38.182: W/MessageQueue(8625): java.lang.RuntimeException: Handler (android.media.MediaPlayer$EventHandler) {416ad6b0} sending message to a Handler on a dead thread
10-04 14:04:38.182: W/MessageQueue(8625): at android.os.MessageQueue.enqueueMessage(MessageQueue.java:196)
10-04 14:04:38.182: W/MessageQueue(8625): at android.os.Handler.sendMessageAtTime(Handler.java:473)
10-04 14:04:38.182: W/MessageQueue(8625): at android.os.Handler.sendMessageDelayed(Handler.java:446)
10-04 14:04:38.182: W/MessageQueue(8625): at android.os.Handler.sendMessage (Handler.java:383)
10-04 14:04:38.182: W/MessageQueue(8625): at android.media.MediaPlayer.postEventFromNative(MediaPlayer.java:1898)
10-04 14:04:38.182: W/MessageQueue(8625): at dalvik.system.NativeStart.run(Native Method)
10-04 14:04:38.182: V/MediaPlayer(8625): back from callback

我已经看到了 this thread和建议的解决方法,但它对我不起作用。

有人有其他解决方案吗?

最佳答案

 // create a handler to post messages to the main thread
Handler mHandler = new Handler(getMainLooper());
mHandler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(getApplicationContext(), "hello", Toast.LENGTH_SHORT).show();
}
});

尝试这段代码希望它有帮助

关于android - GCMIntentService + 在死线程上向处理程序发送消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12726977/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com