This line of code returns a Cursor object:
getContentResolver().query(uri, null, null, null, null);
It is odd that you execute the request, but ignore the result. The sole purpose of executing the query is to get the results in the cursor. You should save this in a variable as follows:
Cursor cursor = getContentResolver().query(uri, null, null, null, null);
Then you can use the cursor to get any data you need, and when you are done with it:
cursor.close();
You can close the cursor in Activity#onDestroy() or earlier, but you must close it before the operation is completed or you will see this warning. This is because the cursor is supported by memory in another process, and you do not want to leak this memory.
source share