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..

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..

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.
This is a Notification alert, this can be started from services, activities,fragments, broadcaster receivers,etc... Check this link: http://developer.android.com/guide/topics/ui/notifiers/notifications.html
This example was copied from google dev:
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.notification_icon)
.setContentTitle("My notification")
.setContentText("Hello World!");
Intent resultIntent = new Intent(this, ResultActivity.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addParentStack(ResultActivity.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(
0,
PendingIntent.FLAG_UPDATE_CURRENT
);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(mId, mBuilder.build());
Good luck!
Build a notification and use setTicker (Look at the doc there) :
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_event)
.setContentTitle(eventTitle)
.setContentText(eventLocation)
.setContentIntent(viewPendingIntent)
.setTicker("Your message");
You can use SYSTEM_ALERT_WINDOW which will show message always on Top whether your application is foreground or background.
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, PixelFormat.TRANSLUCENT);
params.gravity = Gravity.CENTER|Gravity.TOP;
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
wm.addView(view, params);
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />