Code for Status Bar in Android Application Development

To know all the information about the process running over the android operating system, it is important to get the user  friendly status bar. To provides the flexibility and catch all the running processes in the android operating system, status bar provides the vital role in the android application. In this post, we share the code for Code for Status Bar in Android Application Development.

Go through the following steps generate Code for Status Bar in Android Application Development.

Get a reference to the NotificationManager:

String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager;
mNotificationManager=(NotificationManager)getSystemService(ns);

Instantiate the Notification:

int icon = R.drawable.notification_icon;
CharSequence tickerText = “Hello”;
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);

Define the notification’s message and PendingIntent:

Context context = getApplicationContext();
CharSequence contentTitle = "My notification";
CharSequence contentText = "Hello World!";
Intent notificationIntent = new Intent(this, MyClass.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);

Pass the Notification to the NotificationManager

private static int HELLO_ID = 1;
mNotificationManager.notify(HELLO_ID, notification);

Full android web application Tutorial:-

Introduction How to develope Android application

What are the Fundamental Units of Android Application

Step by Step Installation guid for android application developent

How to Build and Run the Android Application

Views in Android Application

Linear Layout in Android Application Development

Table Layout in Android Application

Relative Layout in Android Application

SQLite Database used in Android Application Development

Music Player Code for Android Application Development

How to make Phone call for Android Application with full code

Status Bar in Android Application Development with Full Code

1 Comment
  1. Asin Bengar says

    Good article , with full tutorial , keep writting 🙂

Leave A Reply

Your email address will not be published.