Android error: java.lang.IllegalStateException: trying to requery an already closed cursor
nvironment (Linux/Eclipse Dev for Xoom Tablet running HoneyComb 3.0.1)

In my app I'm using the camera (startIntentForResult()) to take a picture. After the picture is taken I get the onActivityResult() callback and am able to load a Bitmap using a Uri passed via the "take picture" intent.  At that point my activity is resumed and I get an error trying to reload the images into a gallery:

    FATAL EXCEPTION: main
    ERROR/AndroidRuntime(4148): java.lang.RuntimeException: Unable to resume activity {...}: 
     java.lang.IllegalStateException: trying to requery an already closed cursor
         at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2243)
         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1019)
         at android.os.Handler.dispatchMessage(Handler.java:99)
         at android.os.Looper.loop(Looper.java:126)
         at android.app.ActivityThread.main(ActivityThread.java:3997)
         at java.lang.reflect.Method.invokeNative(Native Method)
         at java.lang.reflect.Method.invoke(Method.java:491)
         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
         at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.IllegalStateException: trying to requery an already closed cursor
         at android.app.Activity.performRestart(Activity.java:4337)
         at android.app.Activity.performResume(Activity.java:4360)
         at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2205)
         ... 10 more


The only cursor logic I'm using is that after the image is taken I convert the Uri to a file using the following logic

    String [] projection = {
    	MediaStore.Images.Media._ID, 
    	MediaStore.Images.ImageColumns.ORIENTATION,
    	MediaStore.Images.Media.DATA 
    };
    
    Cursor cursor = activity.managedQuery( 
    		uri,
            projection,  // Which columns to return
            null,        // WHERE clause; which rows to return (all rows)
            null,        // WHERE clause selection arguments (none)
            null);       // Order-by clause (ascending by name)
    
    int fileColumnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
    if (cursor.moveToFirst()) {
        return new File(cursor.getString(fileColumnIndex));
    }
    return null;

Any ideas what I'm doing wrong?
Android error: java.lang.IllegalStateException: trying to requery an already closed cursor
===

nvironment (Linux/Eclipse Dev for Xoom Tablet running HoneyComb 3.0.1)

In my app I'm using the camera (startIntentForResult()) to take a picture. After the picture is taken I get the onActivityResult() callback and am able to load a Bitmap using a Uri passed via the "take picture" intent.  At that point my activity is resumed and I get an error trying to reload the images into a gallery:

    FATAL EXCEPTION: main
    ERROR/AndroidRuntime(4148): java.lang.RuntimeException: Unable to resume activity {...}: 
     java.lang.IllegalStateException: trying to requery an already closed cursor
         at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2243)
         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1019)
         at android.os.Handler.dispatchMessage(Handler.java:99)
         at android.os.Looper.loop(Looper.java:126)
         at android.app.ActivityThread.main(ActivityThread.java:3997)
         at java.lang.reflect.Method.invokeNative(Native Method)
         at java.lang.reflect.Method.invoke(Method.java:491)
         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
         at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.IllegalStateException: trying to requery an already closed cursor
         at android.app.Activity.performRestart(Activity.java:4337)
         at android.app.Activity.performResume(Activity.java:4360)
         at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2205)
         ... 10 more


The only cursor logic I'm using is that after the image is taken I convert the Uri to a file using the following logic

    String [] projection = {
    	MediaStore.Images.Media._ID, 
    	MediaStore.Images.ImageColumns.ORIENTATION,
    	MediaStore.Images.Media.DATA 
    };
    
    Cursor cursor = activity.managedQuery( 
    		uri,
            projection,  // Which columns to return
            null,        // WHERE clause; which rows to return (all rows)
            null,        // WHERE clause selection arguments (none)
            null);       // Order-by clause (ascending by name)
    
    int fileColumnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
    if (cursor.moveToFirst()) {
        return new File(cursor.getString(fileColumnIndex));
    }
    return null;

Any ideas what I'm doing wrong?