RMachnik
RMachnik

Reputation: 3694

NoSuchMethodError Notification.Builder.build()

   Notification noti = new Notification.Builder(context)
            .setContentTitle("TITLE").setContentInfo("INFO")
            .build();
notificationManager.notify(ID,noti);

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?

Upvotes: 3

Views: 4172

Answers (1)

wangqi060934
wangqi060934

Reputation: 1591

Notification.Builder.build() is API level 16.

In 4.0.4,you should use getNotification().

Or you had better use NotificationCompat.

Upvotes: 11

Related Questions