1

In one of my apps' activities there is a map which i load markers from a web request. In the onCreate method i check for internet connection if there is none then i create a Toast notifying the user.

My question is, how does the Activity handle that action so i could put my code to make the web request again?

I tried onResume but nothing happened.

pavlos
  • 547
  • 1
  • 9
  • 23
  • while loading the activity check whether web request has data(empty or not) if it has data then display it else display Toast – Karthick Anbazhagan Jun 20 '17 at 14:23
  • Do you mean that when you return from another activity, onResume's code is not called? Have you tested it with, for instance, Log's? How do you call another activity: with startActivity? – CoolMind Jun 20 '17 at 14:24
  • When the activity starts i check for internet connection before the web request and if there is no internet connection, i display an empty map with no markers and show a Toast. When the user opens their quick menu (swipe from top to down) and opens wi-fi or cellular data and then closes the quick menu, i want to execute the web request again. – pavlos Jun 20 '17 at 14:29
  • Is onResume called after options in a StatusBar have disappeared? – CoolMind Jun 20 '17 at 14:33
  • My guess is no because i tried calling onResume and nothing happened – pavlos Jun 20 '17 at 14:34
  • See https://stackoverflow.com/questions/5888502/how-to-detect-when-wifi-connection-has-been-established-in-android, https://stackoverflow.com/questions/6362314/wifi-connect-disconnect-listener or https://stackoverflow.com/questions/9434235/listening-wifi-state. – CoolMind Jun 20 '17 at 14:36
  • Possible duplicate of [Are there any callback methods for when the quick settings dropdown menu is opened?](https://stackoverflow.com/questions/49139878/are-there-any-callback-methods-for-when-the-quick-settings-dropdown-menu-is-open) – arne.z Jul 22 '19 at 20:51

0 Answers0