ConnectivityManager cn = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo nf = cn.getActiveNetworkInfo();
if (nf != null && nf.isConnected() == true) {
Toast.makeText(getApplicationContext(), "Internet Connected.", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(), "No Internet.", Toast.LENGTH_LONG).show();
}
NetworkInfo nf = cn.getActiveNetworkInfo();
if (nf != null && nf.isConnected() == true) {
Toast.makeText(getApplicationContext(), "Internet Connected.", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(), "No Internet.", Toast.LENGTH_LONG).show();
}
Comments
Post a Comment