Cursor cursor = getContentResolver().query(imgPath,
filePathColumn, null, null, null);
if(cursor.getCount()>0){
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
path = cursor.getString(columnIndex); }
else{
Toast.makeText(getApplicationContext(), "Cursor Null", Toast.LENGTH_SHORT).show();
}
it obviously that getContentResolver().query
return a null cursor. You need make sure the query(imgPath,filePathColumn, null, null, null)
is correct, specially the imgPath
solved Cursor null exception in Samsung galaxy s3 [closed]