Hello!

Interested in this question: how in the VC application was a reboot of the fragment done without a network connection?

alt text

When you click on the "Retry" button, the fragment is overloaded, but how can the "offline_fragment" fragment report which fragment was before it?

  • why do you think this is a restart? I do similar things with the help of several View and do not restart anything - Roman Zakharov
  • Please tell us a little more about how you do it. Now it happens to me like this: there is an isOnline() method in isOnline() , depending on its value, either a fragment with content or an offline fragment is created. In the offline fragment button, I now can not figure out what to specifically write in the handler of this button, that would "overload" the fragment that was before the loss of communication. Now I tried to do the following - I created the lastFragment field in the lastFragment , and if the triggered fragment is not an offline_fragment , then I write it in the field, and then when I press the button, I launch a fragment from this field. - Opalosolo
  • there is an interface, it has 2 methods: onResult () and onException (). at the start of the fragment, the function in which the request to the server is performed. if there is no Internet, the onException () interface method will be called. in it is exposed to a visible View with a repeat button. when the button is pressed, the function in which the request is sent to the server is executed again. if the request was successful, then in the onResult () method we show the View with the main content. - Roman Zakharov

1 answer 1

Before you start the fragment, you send information about who he was called to and when you use “Retry” you start the old fragment.