Android Notification

NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

    Intent notificationIntent = new Intent(this, "Your linked class");

    PendingIntent pi = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_ONE_SHOT);

    Notification note =  new Notification(R.drawable.ic_launcher, "Notification Title", System.currentTimeMillis());

    note.setLatestEventInfo(this, "Title", "Description", pi);

    note.defaults |= Notification.DEFAULT_ALL;

    note.flags |= Notification.FLAG_AUTO_CANCEL;

    int id = Integer.parseInt(intent.getStringExtra("id"));

    manager.notify(id, note);


A simple android application to create status bar notifications

The following android application will create a “Hello World” notification in the status bar. Just copy the following code and paste it in your android app:

public void onCreate(Bundle savedInstanceState) {

//Create notification service reference
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);

//Notification icon
int icon = R.drawable.icon;
CharSequence tickerText = "Hello";

//When to show notification
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);

Context context = getApplicationContext();

//Notification title and text
CharSequence notificationTitle = "My notification";
CharSequence notificationText = "Hello World!";
//Notification intent
Intent notificationIntent = new Intent(this, NotificationAppActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, notificationTitle, notificationText, contentIntent);

final int HELLO_ID = 1;
//Show notification
mNotificationManager.notify(HELLO_ID, notification);


Hiding the Notification Bar and Title Bar in Android

Android Hiding the Status Bar or Notification Bar
Hiding the title bar & status bar is generally used in gaming and full-screen applications in-order to utilize the entire screen area. We come also come across various places where we need to hide the title bar or notifications bar.

What is Status Bar or Notifications Bar and Title bar?

What is Status bar and title bar in Android?

Method 1: Through Code

Hide the Status bar or Notifications Bar and Title Bar through coding (Not recommended)


public void onCreate(Bundle savedInstanceState) {


// Hide the Title Bar

// Hide the Notification or Status Bar

//use in any combinations you want


Method 2: Through AndroidManifest.xml
Hiding the Title bar through AndroidManifest.xml

<activity  android:name=".YourClassName"

Hiding both the Status or Notification bar and Title bar through AndroidManifest.xml

<activity  android:name=".YourClassName"