아래의 소스가 있는데요..
아래 빨간 글에서 에러가 발생하는데
Failed to read row 0, column -1 from a CursorWindow which has 1 rows, 6 columns
왜 저 에러가 발생하는지 모르겠습니다.
genymotion 으로 돌리면 발생하지 않는데 제 폰으로 디바이스 연결하면 자꾸 저 에러가 뜹니다
왜 그러는지 혹시 아시는분 있으신가요?
private File getImageFile(Uri uri) {
Log.d(TAG, uri.getPath());
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Log.d(TAG, "getImageFile : " + uri.toString());
Log.d(TAG, "getImageFile >>>>>>>>>>>> 진입");
Cursor c = getContentResolver().query(mImageCaptureUri, null, null, null, null);
c.moveToNext();
String path = c.getString(c.getColumnIndex(MediaStore.MediaColumns.DATA));
Log.d(TAG, "getImageFile >>>>>>>>>>>> path : " + path);
Log.d(TAG, "getImageFile >>>>>>>>>>>> 종료");
File file = new File(path);
/////////////////
Process: com.ksh.webservertest, PID: 15011
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { dat=content://com.android.providers.media.documents/document/image:23406 flg=0x43 }} to activity {com.ksh.webservertest/com.ksh.webservertest.MainActivity}: java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
at android.app.ActivityThread.deliverResults(ActivityThread.java:3384)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3427)
at android.app.ActivityThread.access$1300(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1248)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
at android.database.CursorWindow.nativeGetString(Native Method)
at android.database.CursorWindow.getString(CursorWindow.java:434)
at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51)
at android.database.CursorWrapper.getString(CursorWrapper.java:114)
at com.ksh.webservertest.MainActivity.getImageFile(MainActivity.java:149)
at com.ksh.webservertest.MainActivity.onActivityResult(MainActivity.java:122)
at android.app.Activity.dispatchActivityResult(Activity.java:5467)