Android通知 - java.lang.Throwable:堆栈转储

时间:2014-01-26 16:33:37

标签: android notifications stack dump

我正在尝试在收到新消息时发出通知。它工作 - 创建通知,显示在状态栏上,当我点击它时,它成功打开我的意图,但在LogCat我接收

  

java.lang.Throwable:stack dump

这是来自LogCat的日志:

01-26 17:22:53.661: W/System.err(11868): java.lang.Throwable: stack dump
01-26 17:22:53.669: W/System.err(11868):    at java.lang.Thread.dumpStack(Thread.java:496)
01-26 17:22:53.669: W/System.err(11868):    at android.app.Notification$Builder.applyStandardTemplate(Notification.java:1504)
01-26 17:22:53.669: W/System.err(11868):    at android.app.Notification$Builder.makeContentView(Notification.java:1624)
01-26 17:22:53.669: W/System.err(11868):    at android.app.Notification$Builder.buildUnstyled(Notification.java:1673)
01-26 17:22:53.669: W/System.err(11868):    at android.app.Notification$Builder.build(Notification.java:1726)
01-26 17:22:53.669: W/System.err(11868):    at android.support.v4.app.NotificationCompatJellybean.build(NotificationCompatJellybean.java:98)
01-26 17:22:53.669: W/System.err(11868):    at android.support.v4.app.NotificationCompat$NotificationCompatImplJellybean.build(NotificationCompat.java:142)
01-26 17:22:53.669: W/System.err(11868):    at android.support.v4.app.NotificationCompat$Builder.build(NotificationCompat.java:558)
01-26 17:22:53.669: W/System.err(11868):    at myPackage.ChatActivity.createNotification(ChatActivity.java:335)
01-26 17:22:53.669: W/System.err(11868):    at myPackage.ChatActivity$2.processMessage(ChatActivity.java:207)
01-26 17:22:53.677: W/System.err(11868):    at org.jivesoftware.smack.Chat.deliver(Chat.java:169)
01-26 17:22:53.677: W/System.err(11868):    at org.jivesoftware.smack.ChatManager.deliverMessage(ChatManager.java:248)
01-26 17:22:53.677: W/System.err(11868):    at org.jivesoftware.smack.ChatManager.access$200(ChatManager.java:49)
01-26 17:22:53.677: W/System.err(11868):    at org.jivesoftware.smack.ChatManager$2.processPacket(ChatManager.java:131)
01-26 17:22:53.677: W/System.err(11868):    at org.jivesoftware.smack.Connection$ListenerWrapper.notifyListener(Connection.java:867)
01-26 17:22:53.677: W/System.err(11868):    at org.jivesoftware.smack.PacketReader$ListenerNotification.run(PacketReader.java:455)
01-26 17:22:53.677: W/System.err(11868):    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)
01-26 17:22:53.685: W/System.err(11868):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
01-26 17:22:53.685: W/System.err(11868):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
01-26 17:22:53.685: W/System.err(11868):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
01-26 17:22:53.685: W/System.err(11868):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
01-26 17:22:53.685: W/System.err(11868):    at java.lang.Thread.run(Thread.java:856)

这是我创建通知的代码:

int id = 0;
Intent intent = new Intent(this, ChatActivity.class);
intent.putExtra("userId", msg.getFrom());
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addParentStack(ChatActivity.class);
stackBuilder.addNextIntent(intent);

PendingIntent pInt = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

NotificationCompat.Builder notification = new NotificationCompat.Builder(this)
  .setContentTitle(msg.getFrom())
  .setContentText(msg.getBody())
  .setSmallIcon(R.drawable.notification_done)
  .setAutoCancel(true);


notification.setContentIntent(pInt);
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(id, notification.build());

有人可以告诉我,问题是什么? 谢谢!

0 个答案:

没有答案