Android Open Source - NoteToGDocs_Drive-Java-API Util






From Project

Back to project page NoteToGDocs_Drive-Java-API.

License

The source code is released under:

GNU General Public License

If you think the Android project NoteToGDocs_Drive-Java-API listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.smokybob.NoteToGDocs;
//from  w  ww  .j a  va 2  s  . com
import android.app.Activity;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class Util {
  //MSO - 20130411 - Check the network State
  public static boolean CheckNetwork(Activity activity){
    boolean toRet=false;
    
    //Get the Connectivity Manager from the calling Activiy
    ConnectivityManager connMgr = (ConnectivityManager) 
            activity.getSystemService(Context.CONNECTIVITY_SERVICE);
    
    //Get The network Infos
    NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
    
    //Check if Connected
    if (networkInfo != null && networkInfo.isConnected()){
      toRet= true;
    }
    else {
      toRet=false;
    }
    
    return toRet;
  } 
}




Java Source Code List

com.smokybob.NoteToGDocs.MainActivity.java
com.smokybob.NoteToGDocs.SettingsActivity.java
com.smokybob.NoteToGDocs.Util.java