'Couldn't read row 305, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it

 Cursor c = activity.getContentResolver().query(CallLog.Calls.CONTENT_URI, null, null, null, CallLog.Calls.DATE + " DESC ");
try{
                photo = c.getString(c.getColumnIndex(CallLog.Calls.CACHED_PHOTO_URI));
                Log.d("PHOTO_URI",photo);
            }catch (Exception e){
                Log.e("ERROR_LOG",e.toString());
            }

ERROR_LOG always returning Couldn't read row 305, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. I was reading the answer. According to that answer what I understood that is, that user was fetching only single column. But I am not doing that here. I am fetching all the columns from CallLog.Calls.CONTENT_URI. So my question is completely different from that. I had tried with c.getInt but it also doesn't work.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source