check if the server is available?
问题 I developing an application which connects to the server. Therefore i want use the bellow function to check if the server is available , But I don't know how I can use it in a thread and how call it each time when I need check if the server is available in activity or fragment : static public boolean isURLReachable(Context context) { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if (netInfo !=