HI, I read developer.android.com and via class connectivitymanager should I get network state info. I want to know is my mobile connected to the internet? I try it like this but it doesn't work. can you help me what I am doing wrong? I have this in onCreate method.
ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); boolean variable = ni.isConnected(); if (variable) Toast.makeText(this, "I'm connected", Toast.LENGTH_SHORT).show(); thank you very much R. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en