开发者

Android service error handling

开发者 https://www.devze.com 2023-01-16 01:32 出处:网络
What is best way for services error handling? For example, I have service which get some information from Internt, I want show to user some dialog with message when connectivity is bad. Or if I have s

What is best way for services error handling? For example, I have service which get some information from Internt, I want show to user some dialog with message when connectivity is bad. Or if I have some Util class for parse HTML that used by my service and exception oc开发者_高级运维cures in this Util class. How to show dialog? As I know DialogBuilder needs some Activity context, but Service context is wrong for this. Right? Thanks.


Have you considered using a notification? You can set a brief message and icon on the task bar, and the user has the option of clicking it, where you can open up a dialog with more details or they can just clear it. You can also clear it within the service if connectivity gets better.

0

精彩评论

暂无评论...
验证码 换一张
取 消