Android Check Network Connection Tabs Loader
<p>I would like to implement check network connection before the tabs are loaded. Can anyone show me how it is done? Below are my codes for my Main Activity. I still can't figure out how it is done. Please help me. </p>

<p>Thank you</p>

<pre><code>public class MainActivity extends SherlockFragmentActivity {
        Tab tab;

        @Override
        public void onCreate(Bundle savedInstanceState) {

            super.onCreate(savedInstanceState);
            if (!isNetworkAvailable()) {
        Toast.makeText(getApplicationContext(),
                "Internet Connection is Not Available", 10).show();
        finish();
    } else { 

    ActionBar actionBar = getSupportActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

        tab = actionBar.newTab().setText("New Games")
                .setTabListener(new NewFragment())
                .setIcon(R.drawable.android);
        actionBar.addTab(tab);

        tab = actionBar.newTab().setText("TOP Games")
                .setTabListener(new TopFragment())
                .setIcon(R.drawable.apple);
        actionBar.addTab(tab);

        tab = actionBar.newTab().setText("BEST Games")
                .setTabListener(new BestFragment())
                .setIcon(R.drawable.reader);
        actionBar.addTab(tab);

}

private boolean isNetworkAvailable() {
    ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo activeNetworkInfo = connectivityManager
            .getActiveNetworkInfo();
    return activeNetworkInfo != null;
}

    }
</code></pre>

<p>LOGCAT :</p>

<pre><code>11-01 21:55:35.023: E/AndroidRuntime(24710): FATAL EXCEPTION: main
11-01 21:55:35.023: E/AndroidRuntime(24710): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{in.wptrafficanalyzer.actionbarsherlocknavtab/in.wptrafficanalyzer.actionbarsherlocknavtab.MainActivity}: java.lang.ClassNotFoundException: in.wptrafficanalyzer.actionbarsherlocknavtab.MainActivity in loader dalvik.system.PathClassLoader[/data/app/in.wptrafficanalyzer.actionbarsherlocknavtab-1.apk]
11-01 21:55:35.023: E/AndroidRuntime(24710):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
11-01 21:55:35.023: E/AndroidRuntime(24710):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
11-01 21:55:35.023: E/AndroidRuntime(24710):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-01 21:55:35.023: E/AndroidRuntime(24710):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
11-01 21:55:35.023: E/AndroidRuntime(24710):    at android.os.Handler.dispatchMessage(Handler.java:99)
11-01 21:55:35.023: E/AndroidRuntime(24710):    at android.os.Looper.loop(Looper.java:130)
11-01 21:55:35.023: E/AndroidRuntime(24710):    at android.app.ActivityThread.main(ActivityThread.java:3691)
11-01 21:55:35.023: E/AndroidRuntime(24710):    at java.lang.reflect.Method.invokeNative(Native Method)
11-01 21:55:35.023: E/AndroidRuntime(24710):    at java.lang.reflect.Method.invoke(Method.java:507)
11-01 21:55:35.023: E/AndroidRuntime(24710):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
11-01 21:55:35.023: E/AndroidRuntime(24710):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
11-01 21:55:35.023: E/AndroidRuntime(24710):    at dalvik.system.NativeStart.main(Native Method)
11-01 21:55:35.023: E/AndroidRuntime(24710): Caused by: java.lang.ClassNotFoundException: in.wptrafficanalyzer.actionbarsherlocknavtab.MainActivity in loader dalvik.system.PathClassLoader[/data/app/in.wptrafficanalyzer.actionbarsherlocknavtab-1.apk]
11-01 21:55:35.023: E/AndroidRuntime(24710):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
11-01 21:55:35.023: E/AndroidRuntime(24710):    at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
11-01 21:55:35.023: E/AndroidRuntime(24710):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
11-01 21:55:35.023: E/AndroidRuntime(24710):    at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-01 21:55:35.023: E/AndroidRuntime(24710):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
11-01 21:55:35.023: E/AndroidRuntime(24710):    ... 11 more
</code></pre>
