I'm creating an application in Android in which checks the Internet connectivity. I want to display a toast message when the Internet connection is very slow. Or when the server does not respond to a request. In this case I want to put a toast like Connection is slow !!!. Here in my code I have found the whether the internet is connected or not, but don't know how to toast the message of internet slow...
public boolean isConnectingToInternet(){
ConnectivityManager connectivity = (ConnectivityManager) _context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity != null)
{
NetworkInfo[] info = connectivity.getAllNetworkInfo();
if (info != null)
for (int i = 0; i < info.length; i++)
if (info[i].getState() == NetworkInfo.State.CONNECTED)
{
return true;
}
}
return false;
}