//get The real path from uri then save it (and then use it to create the file) photosHolder.getInstance().setUriString(getRealPathFromURI(currImageURI)); //Convert the image URI to the direct file system path of the image file private String getRealPathFromURI(Uri contentURI) { String result = ""; try { Cursor cursor = getActivity().getContentResolver().query(contentURI, null, null, null, null); if (cursor == null) { // Source is Dropbox or other similar local file path result = contentURI.getPath(); } else { cursor.moveToFirst(); int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); result = cursor.getString(idx); // Exception raised HERE cursor.close(); } } catch (Exception e) { e.printStackTrace(); } return result; }
java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it and the idx var == to -1
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)