2

There is a croos button in notification, how to add that??

the screenshot contains notifications from two different applications. in the upper notification , there is a cancel button, How to add that button in notification. Any help will be extremely thankful.

Pranav Sharma
  • 652
  • 2
  • 8
  • 21

2 Answers2

2

Use a Custom Notification Layout as outlined in the documentation.

myanimal
  • 3,520
  • 25
  • 26
2

You'd need to create a notification with a custom layout (view here) how to do that. You can attach a click listener with a pending intent to a button like so.

Community
  • 1
  • 1
Toon Borgers
  • 3,453
  • 1
  • 13
  • 22