android - 请求网络接口失败时的提示,能不能写在一个共用的文件里,不用每个请求接口下面都引用,只要监测到请求接口失败,就自动调用
黄舟
黄舟 2017-04-17 17:33:38
0
2
428

请求网络接口失败时,会给出一个失败提示,需要在每个接口下面都写一遍吗,还是有没有办法写在一个共用的文件里,不用每个请求接口下面都引用,只要监测到请求接口失败,就自动调用

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(2)
Peter_Zhu

Because the failure handling action for each request is different, the person who wrote the library cannot judge whether you want to perform the same failure handling. For the sake of generality, it should be written like this.

大家讲道理

Just wrap a class to share it

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template