的NoSuchMethodError Notification.Builder.build()Notification、NoSuchMethodError、build、Builder

由网友(吃掉可爱的你)分享简介:Notification noti = new Notification.Builder(context).setContentTitle("TITLE").setContentInfo("INFO").build();notificationManager.notify(ID,noti);我有该样品是从谷歌网...
   Notification noti = new Notification.Builder(context)
            .setContentTitle("TITLE").setContentInfo("INFO")
            .build();
notificationManager.notify(ID,noti);

我有该样品是从谷歌网页的问题。我有例外的NoSuchMethodError我不知道是怎么回事,所以我用老德precated法通知noti.setLatestEventInfo但我敢肯定有另一种解决方案。任何想法?

I have problem with that sample it is from google page. And I have exception NoSuchMethodError i don't know what's going on so I use old deprecated method with notifications noti.setLatestEventInfo but I'm sure there is another solution. Any ideas?

推荐答案

的 Notification.Builder.build()是API级别16。

在4.0.4,你应该使用的GetNotification()。

In 4.0.4,you should use getNotification().

或者你有更好的使用 NotificationCompat 。

阅读全文

相关推荐

最新文章