-2

Hos do I make a list with notifications in the notification bar (the pull down menu with USB connection mode etc)?

jgauffin
  • 99,844
  • 45
  • 235
  • 372
emmanouil
  • 1
  • 1

1 Answers1

4

Come on dude this is standard stuff:

http://developer.android.com/guide/topics/ui/notifiers/notifications.html

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

int icon = android.R.drawable.ic_media_play;
CharSequence ticketText = "Now - Playing";
long when = System.currentTimeMillis();

Notification notification = new Notification(icon, ticketText, when);

Context context = getApplicationContext();
CharSequence contentTitle = "Now";
CharSequence contentText = "Session";
Intent notificationIntent = new Intent(this, PlayTrack.class);
notificationIntent.addFlags(Notification.FLAG_ONGOING_EVENT);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, 
                                        notificationIntent, 0);

notification.setLatestEventInfo(context, contentTitle,contentText,contentIntent);

mNotificationManager.notify(CONFIDENCE_NOW_ID, notification);
Mr_and_Mrs_D
  • 32,208
  • 39
  • 178
  • 361
Blundell
  • 75,855
  • 30
  • 208
  • 233