Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show a top bar message in Android

I want to show this kind of message in Android top after finishing some background work. How do I show this kind of notification ? Thanks..

enter image description here

like image 821
Rukmal Dias Avatar asked Mar 19 '23 01:03

Rukmal Dias


1 Answers

That looks like the ticker text of a Notification, assuming that this screenshot is of the top of the screen. You can add that to the Notification via setTicker() on your NotificationCompat.Builder. Note, though, that ticker text is no longer displayed as of API Level 21 (Android 5.0). Also note that ticker text automatically disappears after a couple of seconds.

like image 125
CommonsWare Avatar answered Mar 20 '23 16:03

CommonsWare