Advertisement
Ankhwatcher

Android Custom Notification - Not Working

Mar 23rd, 2012
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1.             CharSequence contentText = "Capturing Route: " + highestRoute;
  2.             Notification notification = new Notification();
  3.  
  4.             RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.captureroutenotification);
  5.  
  6.             contentView.setImageViewResource(R.id.notificationIcon, R.drawable.ic_menu_capture);
  7.             contentView.setTextViewText(R.id.notificationTitle, getString(R.string.app_name));
  8.             contentView.setTextViewText(R.id.notificationText, contentText);
  9.  
  10.             notification.contentView = contentView;
  11.  
  12.             Intent notificationIntent = new Intent(getThis, CaptureRouteActivity.class);
  13.             PendingIntent contentIntent = PendingIntent.getActivity(getThis, 0, notificationIntent, 0);
  14.             notification.contentIntent = contentIntent;
  15.             NotificationManager notificationManager = (NotificationManager) getSystemService(ns);
  16.             notificationManager.notify(CAPTURING_ROUTE, notification);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement