public void butClick(View view) { Intent resultIntent = new Intent(this, MainActivity.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setContentTitle("My Title") .setWhen(System.currentTimeMillis()) .setContentIntent(pendingIntent) .setContentText("My text"); mBuilder.setContentIntent(pendingIntent); NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); // mId allows you to update the notification later on. mNotificationManager.notify(1, mBuilder.build()); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)