Last active
June 16, 2022 12:03
-
-
Save mazzouzi/c4aa904cc9f7edac8a63d65dad448227 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
_binding = ActivitySingletonLeakBinding.inflate(layoutInflater) | |
setContentView(binding.root) | |
binding.button.setOnClickListener { | |
coroutineScope.launch(Dispatchers.IO) { | |
delay(500) // simulate API call | |
withContext(Dispatchers.Main) { | |
onError("An error occured") | |
} | |
} | |
} | |
} | |
private fun onError(errorMessage: String) { | |
DialogUtilLeak.getInstance(this).showError("News", errorMessage) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment