Skip to content

Instantly share code, notes, and snippets.

@mazzouzi
Last active June 14, 2022 09:27
Show Gist options
  • Save mazzouzi/33ab07c8bff5e1f34ef444f2ad13200f to your computer and use it in GitHub Desktop.
Save mazzouzi/33ab07c8bff5e1f34ef444f2ad13200f to your computer and use it in GitHub Desktop.
private fun onError(errorMessage: String) {
/**
* Here we pass a copy of the context as a parameter to every functions
* of DialogUtilSolution singleton.
* Once the function returns, the copy is popped off the stack
* -> no memory leak ✅
* Be careful, this code will still leak if the user changes configuration while
* the dialog is displayed because the dialog is not tied to the Activity's lifecycle upon
* recreation. Please check "solutionfinal" package for complete solution.
*/
DialogUtilSolution.showError(this, "News", errorMessage)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment