Intent intent = new Intent(MainActivity.this,NotificationgActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(MainActivity.this,0,intent,0); NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); Notification notification = new NotificationCompat.Builder(MainActivity.this) .setContentTitle("title") .setContentText("neirong") .setWhen(System.currentTimeMillis()) .setSmallIcon(R.mipmap.ic_launcher) .setContentIntent(pendingIntent) .setAutoCancel(true) .setDefaults(NotificationCompat.DEFAULT_ALL) .build(); notificationManager.notify(1,notification);