android - Hide ticker text in notification using Notification.Builder -


i'm trying display ongoing notification without initial ticker text display. able working older style notification setting ticker text null in constructor:

mnotification = new notification(r.drawable.ic_stat_playing, null, system.currenttimemillis()); 

however, noticed instantiating notification way deprecated, , use of notification.builder recommended instead. however, cannot notification display without ticker text, when set ticker text null:

notification.builder builder = new notification.builder(this);  charsequence contenttext = "contenttext here";  intent launchintent = new intent(this, mainactivity.class);  // pendingintent launch our activity if user selects // notification pendingintent contentintent = pendingintent.getactivity(this, -1,                 launchintent, pendingintent.flag_update_current);  builder.setcontentintent(contentintent)     .setsmallicon(r.drawable.ic_stat_playing)     .setlargeicon(null)     .setticker(null)     .setonlyalertonce(true)                      .setwhen(system.currenttimemillis())     .setcontenttitle(contenttitle)     .setongoing(true)     .setcontenttext(contenttext);  mnotification = builder.getnotification();  startforeground(notification_id, mnotification); 

is not possible turn off ticker display new notification.builder? so, that's unfortunate, since won't able update deprecated code.

edit - code worked:

mnotification = builder.getnotification();  mnotification.tickerview = null;  startforeground(notification_id, mnotification); 

try set tickerview null after builder. works fine me code like:

notification notif = builder.build(); notif.tickerview = null; mnotificationmanager.notify(id, notif); 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -