'Lifecycle aware AlertDialog

Is there a way to create a utility class or extension for AlertDialog that is LifeCycle aware? Thus having the possibility of window leak can be completely avoided? Handling of dialog dismissal on each usage cause repetitive code/boilerplate.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source