Zsh расширение файла по нескольким каталогам рекурсивно

Лучший & amp; простой способ установлен builder.setAutoCancel(true), он отменяет ваше уведомление после нажатия на уведомление. Я надеюсь, что этот код вам поможет.

Builder для уведомления

NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setSmallIcon(android.R.drawable.btn_star);
builder.setContentTitle("This is title of notification");
builder.setContentText("This is a notification Text");
builder.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher));

Для открытия активности при нажатии уведомления

Intent intent = new Intent(Broadcastdemo.this, ThreadDemo.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 113,intent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(pendingIntent);
builder.setAutoCancel(true);

Показать имя в уведомлении

g3]
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
manager.notify(114, builder.build());

Полный код для отображения уведомлений со значком, изображением, заголовком, описанием, автоматическим отменам и щелчком мыши открыть действие

public void ShowIntentNotification(View v)
    {
        NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
        builder.setSmallIcon(android.R.drawable.btn_star);
        builder.setContentTitle("This is title of notification");
        builder.setContentText("This is a notification Text");
        builder.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher));

        Intent intent = new Intent(Broadcastdemo.this, ThreadDemo.class);
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 113,intent, PendingIntent.FLAG_UPDATE_CURRENT);

        builder.setContentIntent(pendingIntent);
        builder.setAutoCancel(true);

        NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
        manager.notify(114, builder.build());

    }
0
задан user1934428 26 February 2019 в 13:17
поделиться

1 ответ

foreach f in $BASE/**/*.x(N) достаточно. ** уже соответствует 0 или более каталогов, поэтому шаблон уже соответствует $BASE/*.x.

0
ответ дан chepner 26 February 2019 в 13:17
поделиться
Другие вопросы по тегам:

Похожие вопросы: