android - NotificationCompat.Builder does not set Large and small icon -


this how setting icons. both icons not set. default android icon shown large icon. how solve this?

notificationcompat.builder mbuilder = new notificationcompat.builder(context)                 .setlargeicon(bitmapfactory.decoderesource(context.getresources(), r.mipmap.ic_launcher))                 .setsmallicon(r.drawable.ic_alarm_on_white_24dp)                 .setcontenttitle(context.getresources().getstring(r.string.app_name))                 .setticker(mtitle)                 .setcontenttext(mtitle)                 .setcontentintent(mclick)                 .setautocancel(true)                 .setonlyalertonce(true); 

use notificatio.builder instead of notificationcompat.builder

notification.builder nb = new notification.builder(context)     .setcontenttitle("title")     .setcontenttext("content")     .setautocancel(true)     .setlargeicon(largeicon)     .setsmallicon(r.drawable.small_icon)     .setticker(s.gettext()); notificationmanager nm = (notificationmanager)context.getsystemservice(context.notification_service); nm.notify(100, nb.build()); 

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -