title: How to sync my app with photos
body: <p>I build custom gallery for photos only. I taking photos from sdcard with this class:</p>
  
  <pre><code>public class Photos {
  public static final String PHOTO_BUCKET_NAME =
      Environment.getExternalStorageState().toString() + "/DCIM/Camera";
  public static final int PHOTO_BUCKET_ID = getBucketId(PHOTO_BUCKET_NAME);
  
  public static int getBucketId(String path) {
      return path.toLowerCase().hashCode();
  }
  
  public static List&lt;String&gt; getPhotos(Context context) {
      final String[] projection = {MediaStore.Images.Media.DATA};
      final String selection = MediaStore.Images.Media.BUCKET_ID;
      Cursor c = context.getContentResolver().query(Images.Media.EXTERNAL_CONTENT_URI, projection, selection, null, null);
      List&lt;String&gt; result = new ArrayList&lt;String&gt;(c.getCount());
      if (c.moveToFirst()) {
          int dataColumn = c.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
          do {
              String data = c.getString(dataColumn);
              result.add(data);
          } while (c.moveToNext());
      }
      c.close();
      return result;
  }
  </code></pre>
  
  <p>And set adapter to gallery:</p>
  
  <pre><code>public class ImageAdapter extends BaseAdapter {
      int GalItemBg;
      private Context mContext;
      private List&lt;String&gt; photoList;
  
      public ImageAdapter(Context c) {
          mContext = c;
          photoList = Photos.getPhotos(c);
          TypedArray typArray = obtainStyledAttributes(R.styleable.GalleryTheme);
          GalItemBg = typArray.getResourceId(R.styleable.GalleryTheme_android_galleryItemBackground, 0);
          typArray.recycle();
      }
  
      @Override
      public int getCount() {
          return photoList.size();
      }
  
      @Override
      public Object getItem(int position) {
          return position;
      } 
  
      @Override
      public long getItemId(int position) {
          return position;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          ImageView i = new ImageView(mContext);
  
          Bitmap bm = BitmapFactory.decodeFile(photoList.get(position));
          i.setImageBitmap(bm);
          i.setLayoutParams(new Gallery.LayoutParams(80,70));
          i.setScaleType(ImageView.ScaleType.FIT_XY);
          i.setBackgroundResource(GalItemBg);
  
          return i;
      }
  }
  </code></pre>
  
  <p>}
  There is nothing special. When i run my app, all good it works. After that I launch camera and taking some photos, in this time my app running in background. When I back to my app, I need to see new photos. How to do it?</p>
  
  <p>Tried:
  update adapter in onResume method like this:</p>
  
  <pre><code>Gallery g;
  
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      g = (Gallery) findViewById(R.id.gallery);
      g.setAdapter(new ImageAdapter(this));
  }
   @Override
  public void onResume() {
      g.setAdapter(new ImageAdapter(this));
  }
  </code></pre>
  
  <p>App crashing. May be I do something wrong?</p>
  
  <p>LogCat:</p>
  
  <pre><code>02-09 08:12:33.719: ERROR/AndroidRuntime(276): Uncaught handler: thread main exiting due to uncaught exception
  02-09 08:12:34.129: ERROR/AndroidRuntime(276): java.lang.RuntimeException: Unable to resume activity {ru.home.tabexample/ru.home.tabexample.TabAct}: java.lang.RuntimeException: Unable to resume activity {ru.home.tabexample/ru.home.tabexample.FirstTab}: android.app.SuperNotCalledException: Activity {ru.home.tabexample/ru.home.tabexample.FirstTab} did not call through to super.onResume()
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2950)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2965)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2516)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.access$2200(ActivityThread.java:119)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.os.Handler.dispatchMessage(Handler.java:99)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.os.Looper.loop(Looper.java:123)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.main(ActivityThread.java:4363)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at java.lang.reflect.Method.invokeNative(Native Method)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at java.lang.reflect.Method.invoke(Method.java:521)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at dalvik.system.NativeStart.main(Native Method)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276): Caused by: java.lang.RuntimeException: Unable to resume activity {ru.home.tabexample/ru.home.tabexample.FirstTab}: android.app.SuperNotCalledException: Activity {ru.home.tabexample/ru.home.tabexample.FirstTab} did not call through to super.onResume()
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2950)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:170)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.app.LocalActivityManager.dispatchResume(LocalActivityManager.java:518)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.app.ActivityGroup.onResume(ActivityGroup.java:58)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.app.Activity.performResume(Activity.java:3763)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2937)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     ... 12 more
  02-09 08:12:34.129: ERROR/AndroidRuntime(276): Caused by: android.app.SuperNotCalledException: Activity {ru.home.tabexample/ru.home.tabexample.FirstTab} did not call through to super.onResume()
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.app.Activity.performResume(Activity.java:3765)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2937)
  02-09 08:12:34.129: ERROR/AndroidRuntime(276):     ... 18 more
  </code></pre>