Android Open Source - 1040_searchlit Utils






From Project

Back to project page 1040_searchlit.

License

The source code is released under:

GNU General Public License

If you think the Android project 1040_searchlit 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.example.build2;
/*  w w  w  .  j  a  v a 2 s.  c  o m*/
import android.app.Activity;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class Utils {
  public static boolean isNetworkAvailable(Activity activity) {
    ConnectivityManager connectivity = (ConnectivityManager) activity
        .getSystemService(Context.CONNECTIVITY_SERVICE);
    if (connectivity == null) {
      return false;
    } else {
      NetworkInfo[] info = connectivity.getAllNetworkInfo();
      if (info != null) {
        for (int i = 0; i < info.length; i++) {
          if (info[i].getState() == NetworkInfo.State.CONNECTED) {
            return true;
          }
        }
      }
    }
    return false;
  }

}




Java Source Code List

com.example.build2.Content.java
com.example.build2.DetailActivity.java
com.example.build2.Item.java
com.example.build2.Last.java
com.example.build2.MainActivity.java
com.example.build2.NamesParser.java
com.example.build2.NewsRowAdapter.java
com.example.build2.Utils.java
com.example.build2.myMenu.java
com.example.build2.work.java