Android - Problem executing a asynch task and executing a thread
<p>Can someone help me with this code?  All I'm trying to do is determine whether the device's internet connection is available in a separate Connection class with an asynch task and return the result to my splash screen activity.  If the connection isn't active, I want to throw a dialog alert saying it isn't active and then terminate the app.   I can't get the asynch task to fire off and return a non-null result.</p>

<p>Splash.java:</p>

<pre><code>package com.nwp;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Bundle;



public class Splash extends Activity {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);
    initSplash();   

    }

private void initSplash()
{    
     final ProgressDialog dialog = ProgressDialog.show(this, 
             getResources().getString(R.string.splashCheckInterenetConnection), 
             getResources().getString(R.string.splashPleaseWait), true);  

     Connection.context = this;
     if(!Connection.isOnline());
     {   
         AlertDialog.Builder dlgAlert  = new AlertDialog.Builder(this);
         dlgAlert.setMessage(R.string.splashNoInternetConnection);
         dlgAlert.setCancelable(true);
         dlgAlert.setNeutralButton("Ok", 
                 new DialogInterface.OnClickListener() {                 
             // click listener on the alert box                
             public void onClick(DialogInterface arg0, int arg1)      {                    
                 // the button was clicked                    
                 dialog.dismiss();
                 finish();               
                 }            
             });

         dlgAlert.create().show();



     }

}


}
</code></pre>

<p>Connection.java:</p>

<pre><code>package com.nwp;

import android.content.Context;  
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
public class Connection {

public static Context context;
private static Boolean connectedInternet;

public static Boolean isOnline()
{

     new isOnlineAsync().execute(context);
     return Connection.connectedInternet;
}


// Check Internet Connection 
 private static class isOnlineAsync extends AsyncTask&lt;Context, String, Boolean&gt; {

    @Override
    protected Boolean doInBackground(Context... contexts) {

        try {
            ConnectivityManager cm = (ConnectivityManager) contexts[0].getSystemService(Context.CONNECTIVITY_SERVICE); 
            NetworkInfo netInfo = cm.getActiveNetworkInfo(); 
            boolean OnlineState = netInfo != null &amp;&amp; netInfo.isConnected();
            return OnlineState;
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return false;
        }

    }

    @Override
    protected void onPostExecute(Boolean result) {
      super.onPostExecute(result);

      Connection.connectedInternet = result;



    }  

 }


}
</code></pre>
