If I have a SimpleCursorAdapter and I call getCursor() on my instantiated adapter, should I then close this cursor when I’m finished with it, since java is pass-by-value?
Simple example:
SimpleCursorAdapter adapter = new SimpleCursorAdapter(.....);
myListView.setAdapter(adapter);
Cursor cursor = adapter.getCursor();
cursor.moveToFirst();
int id = cursor.getInt(0);
...?
If I close the cursor here, will it be closed for the adapter or not?
As you said, the Adapter is still using the Cursor, so no, you should not close it. You should only close the Cursor when you are completely finished working with it.