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

ios - Memory not freeing up after popping viewcontroller using ARC -

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -