android - How can i create .setTicker in my notifications bar -


my notifications bar structure in way:

             notification notification = new notification(r.drawable.full,+level+"%",system.currenttimemillis());               notification.flags = notification.flag_ongoing_event;               intent = new intent(context, mainactivity.class);                pendingintent penint = pendingintent.getactivity(getapplicationcontext(), 0 , , 0);               notification.setlatesteventinfo(getapplicationcontext(), "batteria al"+" "+level+"%", "clicca per aprire l'applicazione", penint);               notifi.notify(215,notification);          }    

but don't know how set .setticker structure. how can it? thanks

notification notification = new notification(r.drawable.full,+level+"%",system.currenttimemillis()); 

in line second parameter ticker text. dont need set using other method.

btw constructor deprecated. use notification.builder instead

by using that

 notification noti = new notification.builder(mcontext)          .setcontenttitle("new mail " + sender.tostring())          .setcontenttext(subject)          .setsmallicon(r.drawable.new_mail)          .setlargeicon(abitmap)          .setticker(tickertext)          .build(); 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -