+ Reply to Thread
Results 1 to 2 of 2

Thread: display text in notification bar

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    28

    display text in notification bar

    I`d like to display a text in the notification bar , the same way facebook notify you about any updates.
    is it possible or do i need some kind of special key for that ?

  2. #2
    Junior Member
    Join Date
    May 2012
    Posts
    7
    This is how you can display test inside notification bar :
    Code:
       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);

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts