Context.CONNECTIVITY_SERVICE error. Can't access?
<p>public boolean isOnline() {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
         return cm.getActiveNetworkInfo().isConnectedOrConnecting();
     }</p>

<p>This is the function I want to work.
but I get the error "CONNECTIVITY_SERVICE cannot be resolved or is not a field"
I've added:
uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"
uses-permission android:name="android.permission.INTERNET"</p>

<p>to my manifest file.</p>

<p>these are my imports:</p>

<p>package com.MTSUAndroid;</p>

<p>import java.io.BufferedInputStream;</p>

<p>import java.io.InputStream;</p>

<p>import java.net.URL;</p>

<p>import java.net.URLConnection;</p>

<p>import java.sql.Date;</p>

<p>import java.sql.Timestamp;</p>

<p>import java.util.Calendar;</p>

<p>import android.os.Binder;</p>

<p>import android.os.RemoteException;</p>

<p>import org.apache.http.util.ByteArrayBuffer;</p>

<p>import android.app.Activity;</p>

<p>import android.graphics.Color;</p>

<p>import android.net.ConnectivityManager;</p>

<p>import android.net.NetworkInfo;</p>

<p>import android.os.Bundle;</p>

<p>import android.os.Handler;</p>

<p>import android.widget.Button;</p>

<p>import android.widget.TextView;</p>

<p>import android.text.Html;</p>

<p>import android.text.format.DateFormat;</p>

<p>import android.view.View;</p>

<p>import java.lang.String;</p>

<p>import javax.naming.Context;</p>

<p>I'm not sure what I'm doing wrong if anyone could help..</p>
