public void showNotice(View view) { NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Notification nf = new Notification(R.drawable.ic_launcher, "我是一个notification", System.currentTimeMillis()); nf.flags = Notification.FLAG_AUTO_CANCEL; //自动取消 Intent intent = new Intent(); intent.setAction(Intent.ACTION_CALL); intent.setData(Uri.parse("tel:110")); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,0); nf.setLatestEventInfo(this, "我是标题", "我是内容", pendingIntent); nm.notify(0, nf); //高版本适用; /* Notification.Builder builder = new Builder(this); builder.setContentText("我是notification内容"); builder.setContentTitle("我是标题"); builder.setSmallIcon(R.drawable.ic_launcher). setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher)); Notification nf = builder.build(); nm.notify(0, nf);*/ }