/*
 * Copyright (c) 2014. Ye Lin Aung
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package com.yelinaung.android.utils;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * Created by Ye Lin Aung on 14/01/20.
 */
public class NetUtils {
    // Check the device is connected to the internet
    public static boolean isOnlineOrNot(Context c) {
        NetworkInfo netInfo = null;
        try {
            ConnectivityManager cm = (ConnectivityManager) c
                    .getSystemService(Context.CONNECTIVITY_SERVICE);
            netInfo = cm.getActiveNetworkInfo();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return netInfo != null && netInfo.isConnectedOrConnecting();
    }
}

@@ -740,16 +740,255 @@
 orkInfo;
+%0Aimport android.os.AsyncTask;%0A%0Aimport org.apache.http.HttpResponse;%0Aimport org.apache.http.client.HttpClient;%0Aimport org.apache.http.client.methods.HttpGet;%0Aimport org.apache.http.impl.client.DefaultHttpClient;%0A%0Aimport java.io.IOException;
 %0A%0A/**%0A *
@@ -1404,16 +1404,24 @@
  catch (
+Security
 Exceptio
@@ -1470,16 +1470,16 @@
       %7D%0A
-
         
@@ -1545,10 +1545,909 @@
 ;%0A    %7D%0A
+%0A%0A    public static void getStatus(String weburl)%0A    %7B%0A            new checkWebStatus().execute(weburl);%0A    %7D%0A%0A    //Check the website http response code no%0A   private static class checkWebStatus extends AsyncTask%3CString,Void,String%3E%0A    %7B%0A%0A        @Override%0A        protected String doInBackground(String... weburl) %7B%0A            Integer httpResponse = 0;%0A            try %7B%0A            HttpGet httpGet = new HttpGet(weburl%5B0%5D.toString());%0A            HttpClient client = new DefaultHttpClient();%0A            try %7B%0A                HttpResponse response = client.execute(httpGet);%0A                httpResponse = response.getStatusLine().getStatusCode();%0A            %7D catch (IOException e) %7B%0A                e.printStackTrace();%0A            %7D%0A            %7Dcatch (SecurityException se)%7B%0A                se.printStackTrace();%0A            %7D%0A            return httpResponse.toString();%0A        %7D%0A    %7D%0A
 %7D%0A

add new class for check webstatus