Bakih Bakih - 1 year ago 141
Android Question

notification bar - how to write text there

I want to know how to write notification text only on the notification bar and different text on the Notification layout?

Answer Source
   int icon = R.drawable.notification_icon;        // icon from resources  
   CharSequence tickerText = "Hello";              // ticker-text  
   long when = System.currentTimeMillis();         // notification time  
   Context context = getApplicationContext();      // application Context  
   CharSequence contentTitle = "My notification";  // expanded message title  
   CharSequence contentText = "Hello World!";      // expanded message text  

   Intent notificationIntent = new Intent(this, MyClass.class);  
   PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);  

    // the next two lines initialize the Notification, using the configurations above  
    Notification notification = new Notification(icon, tickerText, when);  
    notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);  

you should look at this link......... Click Me

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download