Efiicient way to show 'Cant access network' View with 'Retry' and additional options like 'Wifi Settings', 'Mobile Network'

折月煮酒 提交于 2019-12-02 20:59:55

Volley DETROYS all listeners as soon as it receives something from the server, regardless of whether the response is a proper response or an error response.

A request needs to constructed everytime it should be sent or resent.

These steps will help achieve it

  • Create a fragment with Retry and other necessary buttons like Wifi Settings, Mobile Network Settings
  • Create a full sized FrameLayout inside RelativeLayout on necessary views to accommodate the fragment created and hide it initially
  • When request fails, make the FrameLayout visible and the retry button should call the function that constructs and calls the request

I have encountered the same needs and issues. I am working on a Volley based library jus where most the issues you have had i handle with rxJava global observables and of course Alerts class with static alerts/views generators. the connectivity handling I try to make it smooth using ConnectivityManager and NoConnectionPolicy concepts.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!