Greetings!
I'm building an app that requires internet use and a whole tab doesn't work without it. 开发者_开发百科I would like it so that when they select the tab it checks if there is internet and if there isn't then a panel slide (or appears) over the controls so that nothing can be done until an connection to the internet is established. How could I achieve this?
Thanks -Mitchell
I think covering the controls would look weird since it would make it look like an empty useless tab. I would say there are two better ways of doing this. The first is when the tab gains focus you can disable or enable all the controls based on the detection of a network connection. The other would be to add or remove the whole tab based on the detection of the connection.
Consider implementing an non-cancelable ProgressDialog (using STYLE_SPINNER) with an AsyncTask that monitors for internet connectivity. Upon connectivity identified, then cancel the ProgressDialog. You may want to provide a timeout also which brings up a relevant error message.
精彩评论