diff --git a/src/com/android/ex/photo/fragments/PhotoViewFragment.java b/src/com/android/ex/photo/fragments/PhotoViewFragment.java
index 6702bd8..ef1ef0d 100644
--- a/src/com/android/ex/photo/fragments/PhotoViewFragment.java
+++ b/src/com/android/ex/photo/fragments/PhotoViewFragment.java
@@ -17,10 +17,15 @@
 
 package com.android.ex.photo.fragments;
 
+import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.PackageManager;
 import android.database.Cursor;
 import android.graphics.Bitmap;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.LoaderManager;
@@ -121,6 +126,9 @@
     protected View mPhotoPreviewAndProgress;
     protected boolean mThumbnailShown;
 
+    /** Whether or not there is currently a connection to the internet */
+    protected boolean mConnected;
+
     /** Public no-arg constructor for allowing the framework to handle orientation changes */
     public PhotoViewFragment() {
         // Do nothing.
@@ -132,7 +140,7 @@
      * @param position
      * @param onlyShowSpinner
      */
-    public static final PhotoViewFragment newInstance(
+    public static PhotoViewFragment newInstance(
             Intent intent, int position, boolean onlyShowSpinner) {
         final Bundle b = new Bundle();
         b.putParcelable(ARG_INTENT, intent);
@@ -155,6 +163,11 @@
         if (mAdapter == null) {
             throw new IllegalStateException("Callback reported null adapter");
         }
+
+        if (hasNetworkStatePermission()) {
+            getActivity().registerReceiver(new InternetStateBroadcastReceiver(),
+                    new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
+        }
         // Don't call until we've setup the entire view
         setViewVisibility();
     }
@@ -244,6 +257,19 @@
         mCallback.addScreenListener(mPosition, this);
         mCallback.addCursorListener(this);
 
+        if (hasNetworkStatePermission()) {
+            ConnectivityManager connectivityManager = (ConnectivityManager)
+                    getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
+            NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo();
+            if (activeNetInfo != null) {
+                mConnected = activeNetInfo.isConnected();
+            } else {
+                // Best to set this to false, since it won't stop us from trying to download,
+                // only allow us to try re-download if we get notified that we do have a connection.
+                mConnected = false;
+            }
+        }
+
         if (!isPhotoBound()) {
             mProgressBarNeeded = true;
             mPhotoPreviewAndProgress.setVisibility(View.VISIBLE);
@@ -367,6 +393,12 @@
         }
     }
 
+    private boolean hasNetworkStatePermission() {
+        final String networkStatePermission = "android.permission.ACCESS_NETWORK_STATE";
+        int result = getActivity().checkCallingOrSelfPermission(networkStatePermission);
+        return result == PackageManager.PERMISSION_GRANTED;
+    }
+
     /**
      * Enable or disable image transformations. When transformations are enabled, this view
      * consumes all touch events.
@@ -512,4 +544,28 @@
     public boolean isProgressBarNeeded() {
         return mProgressBarNeeded;
     }
+
+    private class InternetStateBroadcastReceiver extends BroadcastReceiver {
+
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            // This is only created if we have the correct permissions, so
+            ConnectivityManager connectivityManager = (ConnectivityManager)
+                    context.getSystemService(Context.CONNECTIVITY_SERVICE);
+            NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo();
+            if (activeNetInfo == null) {
+                mConnected = false;
+                return;
+            }
+            if (mConnected == false && activeNetInfo.isConnected() && !isPhotoBound()) {
+                if (mThumbnailShown == false) {
+                    getLoaderManager().restartLoader(LOADER_ID_THUMBNAIL, null,
+                            PhotoViewFragment.this);
+                }
+                getLoaderManager().restartLoader(LOADER_ID_PHOTO, null, PhotoViewFragment.this);
+                mConnected = true;
+                mPhotoProgressBar.setVisibility(View.VISIBLE);
+            }
+        }
+    }
 }
